ソースを参照

调整参数,去掉拼音搜索,只搜索标题和tags

Jacky Wong 4 年 前
コミット
02279b380b
共有1 個のファイルを変更した6 個の追加6 個の削除を含む
  1. 6 6
      search-service-quiz/src/main/java/com/liangjian/search/service/impl/QAProblemService.java

+ 6 - 6
search-service-quiz/src/main/java/com/liangjian/search/service/impl/QAProblemService.java

@@ -55,12 +55,12 @@ public class QAProblemService extends ServiceImpl<QAProblemMapper,QAProblem> imp
         BoolQueryBuilder queryBuilder = boolQuery().
                 must(termQuery("state", 1)).
                 must(boolQuery().
-                        should(matchQuery("tags", keyword).boost(100)).
-                        should(matchQuery("tags.pinyin", keyword).boost(90)).
-                        should(matchQuery("title", keyword).boost(10)).
-                        should(matchQuery("title.pinyin", keyword).boost(9)).
-                        should(matchQuery("describe", keyword)).
-                        should(matchQuery("describe.pinyin", keyword))
+                        should(matchQuery("tags", keyword).boost(10)).
+//                        should(matchQuery("tags.pinyin", keyword).boost(90)).
+                        should(matchQuery("title", keyword).boost(5))
+//                        should(matchQuery("title.pinyin", keyword).boost(9)).
+//                        should(matchQuery("describe", keyword)).
+//                        should(matchQuery("describe.pinyin", keyword))
                 );
         SearchSourceBuilder sourceBuilder = new SearchSourceBuilder().query(queryBuilder);
         SearchRequest request = new SearchRequest("qa_problem").source(sourceBuilder);