|
|
|
@@ -158,7 +158,7 @@ func makeRepoResult(sRes *elastic.SearchResult, Key string) *SearchRes { |
|
|
|
err = json.Unmarshal(source, &recordSource) |
|
|
|
if err == nil { |
|
|
|
record := make(map[string]interface{}) |
|
|
|
record["id"] = recordSource["_id"] |
|
|
|
record["id"] = hit.Id |
|
|
|
record["name"] = recordSource["name"] |
|
|
|
record["owner_name"] = recordSource["owner_name"] |
|
|
|
if recordSource["description"] != nil { |
|
|
|
@@ -281,7 +281,7 @@ func makeUserOrOrgResult(sRes *elastic.SearchResult, Key string, ctx *context.Co |
|
|
|
err = json.Unmarshal(source, &recordSource) |
|
|
|
if err == nil { |
|
|
|
record := make(map[string]interface{}) |
|
|
|
record["id"] = recordSource["_id"] |
|
|
|
record["id"] = hit.Id |
|
|
|
record["name"] = recordSource["name"] |
|
|
|
record["full_name"] = recordSource["full_name"] |
|
|
|
if recordSource["description"] != nil { |
|
|
|
@@ -382,7 +382,7 @@ func makeDatasetResult(sRes *elastic.SearchResult, Key string) *SearchRes { |
|
|
|
err = json.Unmarshal(source, &recordSource) |
|
|
|
if err == nil { |
|
|
|
record := make(map[string]interface{}) |
|
|
|
record["id"] = recordSource["_id"] |
|
|
|
record["id"] = hit.Id |
|
|
|
userId := recordSource["user_id"].(int64) |
|
|
|
user, errUser := models.GetUserByID(userId) |
|
|
|
if errUser == nil { |
|
|
|
@@ -434,10 +434,11 @@ func searchIssue(ctx *context.Context, TableName string, Key string, Page int, P |
|
|
|
ascending := ctx.QueryBool("Ascending") |
|
|
|
boolQ := elastic.NewBoolQuery() |
|
|
|
if Key != "" { |
|
|
|
log.Info("issue Key=" + Key) |
|
|
|
nameQuery := elastic.NewMatchQuery("name", Key).Boost(2).QueryName("f_first") |
|
|
|
contentQuery := elastic.NewMatchQuery("content", Key).Boost(1.5).QueryName("f_second") |
|
|
|
commentQuery := elastic.NewMatchQuery("comment", Key).Boost(1).QueryName("f_third") |
|
|
|
boolQ.Should(nameQuery, contentQuery, commentQuery) |
|
|
|
boolQ.Must(nameQuery, contentQuery, commentQuery) |
|
|
|
} |
|
|
|
isIssueQuery := elastic.NewTermQuery("is_pull", "f") |
|
|
|
boolQ.Must(isIssueQuery) |
|
|
|
@@ -466,7 +467,7 @@ func makeIssueResult(sRes *elastic.SearchResult, Key string) *SearchRes { |
|
|
|
err = json.Unmarshal(source, &recordSource) |
|
|
|
if err == nil { |
|
|
|
record := make(map[string]interface{}) |
|
|
|
record["id"] = recordSource["_id"] |
|
|
|
record["id"] = hit.Id |
|
|
|
record["repo_id"] = recordSource["repo_id"] |
|
|
|
log.Info("recordSource[\"repo_id\"]=" + fmt.Sprint(recordSource["repo_id"])) |
|
|
|
repoIdstr := recordSource["repo_id"].(string) |
|
|
|
|