| @@ -433,15 +433,17 @@ func searchIssue(ctx *context.Context, TableName string, Key string, Page int, P | |||||
| } | } | ||||
| ascending := ctx.QueryBool("Ascending") | ascending := ctx.QueryBool("Ascending") | ||||
| boolQ := elastic.NewBoolQuery() | boolQ := elastic.NewBoolQuery() | ||||
| isIssueQuery := elastic.NewTermQuery("is_pull", "f") | |||||
| boolQ.Must(isIssueQuery) | |||||
| if Key != "" { | if Key != "" { | ||||
| log.Info("issue Key=" + Key) | log.Info("issue Key=" + Key) | ||||
| nameQuery := elastic.NewMatchQuery("name", Key).Boost(2).QueryName("f_first") | nameQuery := elastic.NewMatchQuery("name", Key).Boost(2).QueryName("f_first") | ||||
| contentQuery := elastic.NewMatchQuery("content", Key).Boost(1.5).QueryName("f_second") | contentQuery := elastic.NewMatchQuery("content", Key).Boost(1.5).QueryName("f_second") | ||||
| commentQuery := elastic.NewMatchQuery("comment", Key).Boost(1).QueryName("f_third") | commentQuery := elastic.NewMatchQuery("comment", Key).Boost(1).QueryName("f_third") | ||||
| boolQ.Must(nameQuery, contentQuery, commentQuery) | |||||
| boolQ.Should(nameQuery, contentQuery, commentQuery) | |||||
| } | } | ||||
| isIssueQuery := elastic.NewTermQuery("is_pull", "f") | |||||
| boolQ.Must(isIssueQuery) | |||||
| res, err := client.Search(TableName).Query(boolQ).Sort(SortBy, ascending).From((Page - 1) * PageSize).Size(PageSize).Do(ctx.Req.Context()) | res, err := client.Search(TableName).Query(boolQ).Sort(SortBy, ascending).From((Page - 1) * PageSize).Size(PageSize).Do(ctx.Req.Context()) | ||||
| if err == nil { | if err == nil { | ||||
| searchJson, _ := json.Marshal(res) | searchJson, _ := json.Marshal(res) | ||||