Pārlūkot izejas kodu

ADD:PushFromRank

sunxy 11 mēneši atpakaļ
vecāks
revīzija
a567864c99

+ 3 - 2
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/rank/RankService.java

@@ -131,7 +131,8 @@ public class RankService {
 
         // pushFromRank
         Map<String, List<Video>> pushFromVideosMap = param.getRecallResult().getData().stream()
-                .collect(Collectors.toMap(RecallResult.RecallData::getPushFrom, RecallResult.RecallData::getVideos));
+                .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;
@@ -149,7 +150,7 @@ public class RankService {
                         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);
+                                    pushFromRank.put(p, i + 1);
                                     break;
                                 }
                             }

+ 2 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/rank/strategy/RankStrategy4ShareDeepAndWidth.java

@@ -163,6 +163,8 @@ public class RankStrategy4ShareDeepAndWidth extends RankStrategy4RegionMergeMode
 
             if (sumShareCount > 30) {
                 score += a * daySharedepthMaxAvg + b * daySharewidthMaxAvg;
+                item.getScoresMap().put("dayShareDepthMaxAvg", daySharedepthMaxAvg);
+                item.getScoresMap().put("dayShareWidthMaxAvg", daySharewidthMaxAvg);
             }
 
             Video video = item.getVideo();