|
@@ -2,7 +2,6 @@ package com.tzld.piaoquan.recommend.server.service.rank;
|
|
|
|
|
|
|
|
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
-import com.google.common.reflect.TypeToken;
|
|
|
|
import com.tzld.piaoquan.recommend.feature.domain.video.base.ItemFeature;
|
|
import com.tzld.piaoquan.recommend.feature.domain.video.base.ItemFeature;
|
|
import com.tzld.piaoquan.recommend.feature.domain.video.base.RequestContext;
|
|
import com.tzld.piaoquan.recommend.feature.domain.video.base.RequestContext;
|
|
import com.tzld.piaoquan.recommend.feature.domain.video.base.UserFeature;
|
|
import com.tzld.piaoquan.recommend.feature.domain.video.base.UserFeature;
|
|
@@ -12,21 +11,15 @@ import com.tzld.piaoquan.recommend.server.model.MachineInfo;
|
|
import com.tzld.piaoquan.recommend.server.model.Video;
|
|
import com.tzld.piaoquan.recommend.server.model.Video;
|
|
import com.tzld.piaoquan.recommend.server.remote.FeatureRemoteService;
|
|
import com.tzld.piaoquan.recommend.server.remote.FeatureRemoteService;
|
|
import com.tzld.piaoquan.recommend.server.service.flowpool.FlowPoolConstants;
|
|
import com.tzld.piaoquan.recommend.server.service.flowpool.FlowPoolConstants;
|
|
-import com.tzld.piaoquan.recommend.server.service.rank.extractor.RankExtractorFeature;
|
|
|
|
-import com.tzld.piaoquan.recommend.server.service.rank.processor.RankProcessorDensity;
|
|
|
|
import com.tzld.piaoquan.recommend.server.service.recall.RecallResult;
|
|
import com.tzld.piaoquan.recommend.server.service.recall.RecallResult;
|
|
import com.tzld.piaoquan.recommend.server.service.recall.strategy.*;
|
|
import com.tzld.piaoquan.recommend.server.service.recall.strategy.*;
|
|
import com.tzld.piaoquan.recommend.server.service.score.ScoreParam;
|
|
import com.tzld.piaoquan.recommend.server.service.score.ScoreParam;
|
|
import com.tzld.piaoquan.recommend.server.service.score.ScorerUtils;
|
|
import com.tzld.piaoquan.recommend.server.service.score.ScorerUtils;
|
|
import com.tzld.piaoquan.recommend.server.util.CommonCollectionUtils;
|
|
import com.tzld.piaoquan.recommend.server.util.CommonCollectionUtils;
|
|
-import com.tzld.piaoquan.recommend.server.util.JSONUtils;
|
|
|
|
-import lombok.Getter;
|
|
|
|
-import lombok.Setter;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.lang3.RandomUtils;
|
|
import org.apache.commons.lang3.RandomUtils;
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
@@ -89,13 +82,15 @@ public class RankService {
|
|
public List<Video> mergeAndRankRovRecall(RankParam param) {
|
|
public List<Video> mergeAndRankRovRecall(RankParam param) {
|
|
// TODO ab test
|
|
// TODO ab test
|
|
// TODO 抽象成Strategy
|
|
// TODO 抽象成Strategy
|
|
- boolean hitTest = newRankSwitch
|
|
|
|
- || CommonCollectionUtils.contains(param.getAbExpCodes(), newRankAbExpCode);
|
|
|
|
- if (hitTest) {
|
|
|
|
- return mergeAndRankRovRecallNew(param);
|
|
|
|
- } else {
|
|
|
|
- return mergeAndRankRovRecallOld(param);
|
|
|
|
- }
|
|
|
|
|
|
+// boolean hitTest = newRankSwitch
|
|
|
|
+// || CommonCollectionUtils.contains(param.getAbExpCodes(), newRankAbExpCode);
|
|
|
|
+// if (hitTest) {
|
|
|
|
+// return mergeAndRankRovRecallNew(param);
|
|
|
|
+// } else {
|
|
|
|
+// return mergeAndRankRovRecallOld(param);
|
|
|
|
+// }
|
|
|
|
+ // 研发重写了代码,直接走新逻辑
|
|
|
|
+ return mergeAndRankRovRecallOld(param);
|
|
}
|
|
}
|
|
|
|
|
|
public List<Video> mergeAndRankRovRecallOld(RankParam param) {
|
|
public List<Video> mergeAndRankRovRecallOld(RankParam param) {
|
|
@@ -105,13 +100,14 @@ public class RankService {
|
|
rovRecallRank.addAll(extractAndSort(param, Region24HRecallStrategy.PUSH_FORM));
|
|
rovRecallRank.addAll(extractAndSort(param, Region24HRecallStrategy.PUSH_FORM));
|
|
rovRecallRank.addAll(extractAndSort(param, RegionRelative24HRecallStrategy.PUSH_FORM));
|
|
rovRecallRank.addAll(extractAndSort(param, RegionRelative24HRecallStrategy.PUSH_FORM));
|
|
rovRecallRank.addAll(extractAndSort(param, RegionRelative24HDupRecallStrategy.PUSH_FORM));
|
|
rovRecallRank.addAll(extractAndSort(param, RegionRelative24HDupRecallStrategy.PUSH_FORM));
|
|
|
|
+ rovRecallRank.addAll(extractAndSort(param, RegionHWithoutDupRecallStrategy.PUSH_FORM));
|
|
|
|
|
|
// @zhangbo 增加不同召回子策略的返回数量-阿波罗:region.recall.return.size
|
|
// @zhangbo 增加不同召回子策略的返回数量-阿波罗:region.recall.return.size
|
|
String abCode = param.getAbCode();
|
|
String abCode = param.getAbCode();
|
|
int sizeReturn = param.getSize();
|
|
int sizeReturn = param.getSize();
|
|
if (abCode != null && this.regionRecallReturnSize != null &&
|
|
if (abCode != null && this.regionRecallReturnSize != null &&
|
|
this.regionRecallReturnSize.containsKey(abCode) &&
|
|
this.regionRecallReturnSize.containsKey(abCode) &&
|
|
- this.regionRecallReturnSize.get(abCode) != null ){
|
|
|
|
|
|
+ this.regionRecallReturnSize.get(abCode) != null) {
|
|
sizeReturn = this.regionRecallReturnSize.get(abCode).getOrDefault("result_size", sizeReturn);
|
|
sizeReturn = this.regionRecallReturnSize.get(abCode).getOrDefault("result_size", sizeReturn);
|
|
}
|
|
}
|
|
|
|
|