From aeb65b48632b53d39f71bb505883ecd3dfbab886 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 22 Feb 2022 17:09:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/search.js | 2 +- routers/search.go | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/public/home/search.js b/public/home/search.js index 13d044e89..73a39cf49 100644 --- a/public/home/search.js +++ b/public/home/search.js @@ -157,7 +157,7 @@ function displayRepoResult(page,jsonResult,onlyReturnNum,keyword){ } html += "
"; html += " "; html += "
"; diff --git a/routers/search.go b/routers/search.go index 63b867e18..510ac0339 100644 --- a/routers/search.go +++ b/routers/search.go @@ -174,6 +174,7 @@ func makeRepoResult(sRes *elastic.SearchResult, Key string, OnlyReturnNum bool) record := make(map[string]interface{}) record["id"] = hit.Id record["name"] = getLabelValue("name", recordSource, hit.Highlight) + record["real_name"] = recordSource["name"] record["owner_name"] = recordSource["owner_name"] if recordSource["description"] != nil { desc := getLabelValue("description", recordSource, hit.Highlight) @@ -187,7 +188,12 @@ func makeRepoResult(sRes *elastic.SearchResult, Key string, OnlyReturnNum bool) record["num_forks"] = recordSource["num_forks"] record["topics"] = recordSource["topics"] if record["topics"] != nil { - log.Info("record[\"topics\"]=" + record["topics"].(string)) + topicsStr := record["topics"].(string) + topicsStr = strings.Replace(topicsStr, "\"", "", -1) + topicsStr = topicsStr[1 : len(topicsStr)-1] + log.Info("record[\"topics\"]=" + topicsStr) + topicstmp := strings.Split(topicsStr, ",") + record["topics"] = topicstmp } if recordSource["avatar"] != nil { record["avatar"] = setting.AppSubURL + "/repo-avatars/" + recordSource["avatar"].(string)