Authored by hugufei

fromindex++, 默认排序和关注排序都按相关性来

... ... @@ -225,11 +225,7 @@ public class UserRecallResponseResultBuilder {
//3、兜底数据处理-最多100个
this.dealCommonRecallResults(sknResultList, pageSize);
//4、按综合得分排序
if (userRecallRequest.isDefaultOrder()) {
Collections.sort(sknResultList, (o1, o2) -> o2.getScore().compareTo(o1.getScore()));
} else {
Collections.shuffle(sknResultList);
}
Collections.sort(sknResultList, (o1, o2) -> o2.getScore().compareTo(o1.getScore()));
return sknResultList;
}
... ... @@ -280,7 +276,7 @@ public class UserRecallResponseResultBuilder {
//3、获取需要占坑的参数名称
List<StragetyIntervalInfo> intervalStrategyConfigs = recallConfigService.queryIntervalStrategyNames(userRecallRequest);
RecallLoggerHelper.infoDetail(userRecallRequest,"intervalStrategyConfigs config is[{}]", JSON.toJSONString(intervalStrategyConfigs));
RecallLoggerHelper.infoDetail(userRecallRequest, "intervalStrategyConfigs config is[{}]", JSON.toJSONString(intervalStrategyConfigs));
//4、过滤和排序
intervalStrategyConfigs = intervalStrategyConfigs.stream().filter(a -> strageResults.contains(a.getStragetyName())).sorted(Comparator.comparing(StragetyIntervalInfo::getInsertOrder)).collect(Collectors.toList());
... ... @@ -305,7 +301,7 @@ public class UserRecallResponseResultBuilder {
intervalKeys.add(sknResult.getIntervalKey());
}
}
RecallLoggerHelper.infoDetail(userRecallRequest,"strategy2IntervalKeyMap info is[{}]", JSON.toJSONString(strategy2IntervalKeyMap));
RecallLoggerHelper.infoDetail(userRecallRequest, "strategy2IntervalKeyMap info is[{}]", JSON.toJSONString(strategy2IntervalKeyMap));
// 7、占坑
int fromIndex = 1;
... ... @@ -317,13 +313,12 @@ public class UserRecallResponseResultBuilder {
}
Set<String> intervalKeys = strategy2IntervalKeyMap.get(strategyName);
if (CollectionUtils.isEmpty(intervalKeys)) {
this.addByIndexIndex(sknResultList, results, fromIndex, recallInterval, (skn) -> strategyName.equals(skn.getStrategy().name()), (skn) -> skn.isOnlyOneStrategy());
this.addByIndexIndex(sknResultList, results, fromIndex++, recallInterval, (skn) -> strategyName.equals(skn.getStrategy().name()), (skn) -> skn.isOnlyOneStrategy());
continue;
}
for (String intervalKey : intervalKeys) {
this.addByIndexIndex(sknResultList, results, fromIndex, recallInterval, (skn -> strategyName.equals(skn.getStrategy().name()) && intervalKey.equalsIgnoreCase(skn.getIntervalKey())), (skn) -> skn.isOnlyOneStrategy());
this.addByIndexIndex(sknResultList, results, fromIndex++, recallInterval, (skn -> strategyName.equals(skn.getStrategy().name()) && intervalKey.equalsIgnoreCase(skn.getIntervalKey())), (skn) -> skn.isOnlyOneStrategy());
}
fromIndex++;
}
return results;
}
... ...