From ed86391725faa80ff2a51aa392b9b12fb413678b Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 24 Dec 2021 11:40:39 +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 --- routers/search.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/routers/search.go b/routers/search.go index 0956ff953..67ea72228 100644 --- a/routers/search.go +++ b/routers/search.go @@ -44,9 +44,9 @@ func Search(ctx *context.Context) { nameQuery := elastic.NewTermQuery("name", Key) descriptionQuery := elastic.NewTermQuery("description", Key) - boolQ.Filter(nameQuery) - boolQ.Filter(descriptionQuery) + boolQ.Should(nameQuery, descriptionQuery) + //boolQ.Filter(descriptionQuery) - res, err := client.Search(TableName + "-es-index").Query(nameQuery).Do(ctx.Req.Context()) + res, err := client.Search(TableName + "-es-index").Query(boolQ).Do(ctx.Req.Context()) ctx.JSON(200, res) }