|
@@ -117,6 +117,7 @@ public class RankService {
|
|
|
if (CollectionUtils.isEmpty(param.getRecallResult().getData())) {
|
|
|
return;
|
|
|
}
|
|
|
+ // pushFromIndex
|
|
|
Map<Long, Set<String>> videoIdPushFromMap = new HashMap<>();
|
|
|
for (RecallResult.RecallData data : param.getRecallResult().getData()) {
|
|
|
if (CollectionUtils.isEmpty(data.getVideos())) {
|
|
@@ -127,6 +128,11 @@ public class RankService {
|
|
|
pushFromSet.add(data.getPushFrom());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // pushFromRank
|
|
|
+ Map<String, List<Video>> pushFromVideosMap = param.getRecallResult().getData().stream()
|
|
|
+ .collect(Collectors.toMap(RecallResult.RecallData::getPushFrom, result -> result.getVideos() == null
|
|
|
+ ? new ArrayList<>() : result.getVideos(), (v1, v2) -> v2));
|
|
|
for (RecallResult.RecallData data : param.getRecallResult().getData()) {
|
|
|
if (CollectionUtils.isEmpty(data.getVideos())) {
|
|
|
continue;
|
|
@@ -134,12 +140,29 @@ public class RankService {
|
|
|
for (Video video : data.getVideos()) {
|
|
|
Set<String> pushFromSet = videoIdPushFromMap.get(video.getVideoId());
|
|
|
if (pushFromSet != null && pushFromSet.size() > 0) {
|
|
|
- Map<String, List<String>> map = new HashMap<>();
|
|
|
- pushFromSet.forEach(p -> map.computeIfAbsent(p, k -> new ArrayList<>()));
|
|
|
- video.setPushFromIndex(map);
|
|
|
+ Map<String, List<String>> pushFromIndex = new HashMap<>();
|
|
|
+ Map<String, Integer> pushFromRank = new HashMap<>();
|
|
|
+ pushFromSet.forEach(p -> {
|
|
|
+
|
|
|
+ pushFromIndex.computeIfAbsent(p, k -> new ArrayList<>());
|
|
|
+
|
|
|
+ List<Video> videos = pushFromVideosMap.get(p);
|
|
|
+ if (CollectionUtils.isNotEmpty(videos)) {
|
|
|
+ for (int i = 0; i < videos.size(); i++) {
|
|
|
+ if (Objects.equals(videos.get(i).getVideoId(), video.getVideoId())) {
|
|
|
+ pushFromRank.put(p, i + 1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ video.setPushFromIndex(pushFromIndex);
|
|
|
+ video.setPushFromRank(pushFromRank);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public void rankFilter(RankParam param, List<Video> rovRecallRank, List<Video> flowPoolRank) {
|