|
@@ -50,6 +50,7 @@ public class LegislationServiceImpl implements LegislationService {
|
|
|
|
|
|
private static QueryBuilder queryUnit(LegislationSearchType queryScope, String content) {
|
|
|
BoolQueryBuilder boolQuery = boolQuery();
|
|
|
+
|
|
|
switch (queryScope) {
|
|
|
case TITLE:
|
|
|
boolQuery.filter(boolQuery()
|
|
@@ -71,21 +72,37 @@ public class LegislationServiceImpl implements LegislationService {
|
|
|
);
|
|
|
break;
|
|
|
default:
|
|
|
- boolQuery.filter(boolQuery()
|
|
|
- .should(matchQuery("content", content).minimumShouldMatch("100%"))
|
|
|
+
|
|
|
+
|
|
|
+ boolQuery.should(boolQuery().filter(boolQuery()
|
|
|
+// .should(matchQuery("content", content).minimumShouldMatch("100%"))
|
|
|
.should(matchQuery("title", content))
|
|
|
.should(termQuery("title.keyword", content))
|
|
|
- );
|
|
|
- boolQuery.should(disMaxQuery()
|
|
|
- .add(matchPhraseQuery("content", content).boost(25))
|
|
|
- .add(matchQuery("content", content).boost(20).minimumShouldMatch("100%"))
|
|
|
- .add(matchQuery("content", content).boost(2))
|
|
|
+ ).boost(0));
|
|
|
+
|
|
|
+ boolQuery.should(boolQuery().filter(boolQuery()
|
|
|
+ .should(matchPhraseQuery("content", content))
|
|
|
+ ).boost(25));
|
|
|
+
|
|
|
+ boolQuery.should(boolQuery().filter(boolQuery()
|
|
|
+ .should(matchQuery("content", content).boost(20).minimumShouldMatch("100%"))
|
|
|
+ ).boost(20));
|
|
|
+
|
|
|
+ boolQuery.should(boolQuery().filter(boolQuery()
|
|
|
+ .should(matchQuery("content", content))
|
|
|
+ ).boost(2));
|
|
|
+
|
|
|
+
|
|
|
+ boolQuery.should(boolQuery().should(disMaxQuery()
|
|
|
+// .add(matchPhraseQuery("content", content).boost(25))
|
|
|
+// .add(matchQuery("content", content).boost(20).minimumShouldMatch("100%"))
|
|
|
+// .add(matchQuery("content", content).boost(2))
|
|
|
.add(disMaxQuery()
|
|
|
.add(matchQuery("title.standard", content).minimumShouldMatch("100%").boost(20))
|
|
|
.add(matchQuery("title.trim", content).boost(20).minimumShouldMatch("100%"))
|
|
|
.add(termQuery("title.keyword", content).boost(100))
|
|
|
.tieBreaker(0.3f))
|
|
|
- );
|
|
|
+ ));
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -140,7 +157,6 @@ public class LegislationServiceImpl implements LegislationService {
|
|
|
, highlightField
|
|
|
, null
|
|
|
);
|
|
|
-
|
|
|
return search;
|
|
|
}
|
|
|
}
|