Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.3.2^2
zouap 3 years ago
parent
commit
7bc3969073
1 changed files with 8 additions and 6 deletions
  1. +8
    -6
      routers/search.go

+ 8
- 6
routers/search.go View File

@@ -186,14 +186,16 @@ func makeRepoResult(sRes *elastic.SearchResult, Key string, OnlyReturnNum bool)
record["num_watches"] = recordSource["num_watches"]
record["num_stars"] = recordSource["num_stars"]
record["num_forks"] = recordSource["num_forks"]
record["topics"] = recordSource["topics"]
if record["topics"] != nil {
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 topicsStr != "null" {
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)


Loading…
Cancel
Save