Authored by Gino Zhang

调小count的系数到0.1

... ... @@ -275,11 +275,11 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl
.operator(MatchQueryBuilder.Operator.OR)
.minimumShouldMatch("20%");
// 根据关联的数量增加打分
// 根据关联的数量增加打分 _score = _score * 0.1 * log(count + 2)
FunctionScoreQueryBuilder functionScoreQueryBuilder = new FunctionScoreQueryBuilder(queryBuilder);
functionScoreQueryBuilder.add(ScoreFunctionBuilders.fieldValueFactorFunction(countField).factor(0.2F).modifier(FieldValueFactorFunction.Modifier.LOG2P).missing(0));
functionScoreQueryBuilder.add(ScoreFunctionBuilders.fieldValueFactorFunction(countField).factor(0.1F).modifier(FieldValueFactorFunction.Modifier.LOG2P).missing(0));
searchParam.setQuery(functionScoreQueryBuilder);
searchParam.setQuery(queryBuilder);
searchParam.setPage(1);
searchParam.setSize(5);
searchParam.setFiter(QueryBuilders.rangeQuery(countField).gte(20));
... ...