Browse Source

提交代码。

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

+ 5
- 5
routers/search.go View File

@@ -41,11 +41,11 @@ func Search(ctx *context.Context) {

boolQ := elastic.NewBoolQuery()

nameQuery := elastic.NewTermQuery("name", Key)
descriptionQuery := elastic.NewTermQuery("description", Key)
boolQ.Should(nameQuery, descriptionQuery)
//boolQ.Filter(descriptionQuery)
if Key != "" {
nameQuery := elastic.NewTermQuery("name", Key)
descriptionQuery := elastic.NewTermQuery("description", Key)
boolQ.Should(nameQuery, descriptionQuery)
}

res, err := client.Search(TableName + "-es-index").Query(boolQ).Do(ctx.Req.Context())
ctx.JSON(200, res)


Loading…
Cancel
Save