Authored by Gino Zhang

conversion优先采用完全匹配的source

... ... @@ -426,7 +426,13 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl
// 2) 根据terms搜索构造搜索请求
SearchParam searchParam = new SearchParam();
MatchQueryBuilder queryBuilder = QueryBuilders.matchQuery("source", queryWord);
searchParam.setQuery(queryBuilder);
FunctionScoreQueryBuilder functionScoreQueryBuilder = new FunctionScoreQueryBuilder(queryBuilder);
// 2.1) 优先取完全匹配的Term
functionScoreQueryBuilder.add(QueryBuilders.termQuery("source.source_keyword", queryWord.trim().toLowerCase()),
ScoreFunctionBuilders.weightFactorFunction(100));
functionScoreQueryBuilder.boostMode(CombineFunction.MULT);
searchParam.setQuery(functionScoreQueryBuilder);
searchParam.setPage(1);
searchParam.setSize(1);
searchParam.setFiter(QueryBuilders.termQuery("status", 1));
... ...