瀏覽代碼

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

Jacky Wong 4 年之前
父節點
當前提交
02279b380b

+ 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);