|
@@ -76,17 +76,17 @@ public class SearchV8SimpServiceImpl implements SearchService {
|
|
boolQuery.should(termQuery("history_name.value.keyword", content).boost(100));
|
|
boolQuery.should(termQuery("history_name.value.keyword", content).boost(100));
|
|
|
|
|
|
|
|
|
|
- // 0.7* max(商标全匹配*20,产品全匹配*40) + 0.3 * sum(商标全匹配*20,产品全匹配*40)
|
|
|
|
- boolQuery.should(disMaxQuery().add(
|
|
|
|
- QueryBuilders.boolQuery()
|
|
|
|
|
|
+ // sum(商标全匹配*20,产品全匹配*40)
|
|
|
|
+ boolQuery.should(
|
|
|
|
+ boolQuery()
|
|
.should(termQuery("app_info.keyword", content).boost(40))
|
|
.should(termQuery("app_info.keyword", content).boost(40))
|
|
.should(termQuery("company_tm.keyword", content).boost(20))
|
|
.should(termQuery("company_tm.keyword", content).boost(20))
|
|
- ).tieBreaker(0.3F)
|
|
|
|
|
|
+
|
|
);
|
|
);
|
|
|
|
|
|
- // 0.6* max(商标*5,产品信息*15,商标全匹配*20,产品全匹配*40) + 0.4 * sum(商标*5,产品信息*15,商标全匹配*20,产品全匹配*40)
|
|
|
|
- boolQuery.should(disMaxQuery().add(
|
|
|
|
- QueryBuilders.boolQuery()
|
|
|
|
|
|
+ // sum(商标*5,产品信息*15,商标全匹配*20,产品全匹配*40)
|
|
|
|
+ boolQuery.should(
|
|
|
|
+ boolQuery()
|
|
|
|
|
|
.should(matchQuery("app_info", content).boost(15))
|
|
.should(matchQuery("app_info", content).boost(15))
|
|
.should(matchQuery("company_tm", content).boost(5))
|
|
.should(matchQuery("company_tm", content).boost(5))
|
|
@@ -95,25 +95,23 @@ public class SearchV8SimpServiceImpl implements SearchService {
|
|
.should(termQuery("company_tm.keyword", content).boost(20))
|
|
.should(termQuery("company_tm.keyword", content).boost(20))
|
|
// 加入最小匹配度
|
|
// 加入最小匹配度
|
|
.minimumShouldMatch("5<80%")
|
|
.minimumShouldMatch("5<80%")
|
|
- ).tieBreaker(0.4F)
|
|
|
|
);
|
|
);
|
|
|
|
|
|
MultiMatchQueryBuilder multiMatchQueryBuilder = multiMatchQuery(content)
|
|
MultiMatchQueryBuilder multiMatchQueryBuilder = multiMatchQuery(content)
|
|
.operator(Operator.AND)
|
|
.operator(Operator.AND)
|
|
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
|
|
.type(MultiMatchQueryBuilder.Type.CROSS_FIELDS)
|
|
.minimumShouldMatch("5<80%")
|
|
.minimumShouldMatch("5<80%")
|
|
- .tieBreaker(0.3F);
|
|
|
|
- //公司现用名*16+曾用名*12
|
|
|
|
- multiMatchQueryBuilder
|
|
|
|
|
|
+ .tieBreaker(0.3F)
|
|
|
|
+ //公司现用名*16+曾用名*12
|
|
.field("cname.value", 16)
|
|
.field("cname.value", 16)
|
|
- .field("history_name.value", 12)
|
|
|
|
- ;
|
|
|
|
|
|
+ .field("history_name.value", 12);
|
|
|
|
|
|
boolQuery.should(multiMatchQueryBuilder);
|
|
boolQuery.should(multiMatchQueryBuilder);
|
|
- BoolQueryBuilder boolQuery2 = QueryBuilders.boolQuery();
|
|
|
|
- // 过deleted非0数据
|
|
|
|
- boolQuery2.filter(QueryBuilders.termQuery("deleted", "0"));
|
|
|
|
- boolQuery2.must(boolQuery);
|
|
|
|
|
|
+
|
|
|
|
+ BoolQueryBuilder boolQuery2 = boolQuery()
|
|
|
|
+ // 过deleted非0数据
|
|
|
|
+ .filter(termQuery("deleted", "0"))
|
|
|
|
+ .must(boolQuery);
|
|
return boolQuery2;
|
|
return boolQuery2;
|
|
|
|
|
|
}
|
|
}
|