|
@@ -3,6 +3,7 @@ package com.tzld.longarticle.recommend.server.service.rank.strategy;
|
|
|
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.ArticleTypeEnum;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.RankStrategyEnum;
|
|
|
+import com.tzld.longarticle.recommend.server.common.enums.ScoreStrategyEnum;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.Content;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
|
|
@@ -12,7 +13,6 @@ import com.tzld.longarticle.recommend.server.service.rank.*;
|
|
|
import com.tzld.longarticle.recommend.server.service.score.AccountIndexReplacePoolConfig;
|
|
|
import com.tzld.longarticle.recommend.server.service.score.ScoreResult;
|
|
|
import com.tzld.longarticle.recommend.server.service.score.ScoreService;
|
|
|
-import com.tzld.longarticle.recommend.server.service.score.strategy.*;
|
|
|
import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
@@ -53,40 +53,41 @@ public class RankV14Strategy implements RankStrategy {
|
|
|
c.setScoreMap(scoreMap.get(c.getId()));
|
|
|
item.setScoreMap(scoreMap.get(c.getId()));
|
|
|
double score;
|
|
|
+ int index = weightService.getIndex(item.getContent().getContentPoolType(), contentPools);
|
|
|
if (contentPools[0].equals(item.getContent().getContentPoolType())) {
|
|
|
- double similarityScore = Math.pow(item.getScore(SimilarityStrategy.class.getSimpleName()),
|
|
|
- weightService.getWeight(param.getStrategy(), 1,
|
|
|
- SimilarityStrategy.class.getSimpleName()));
|
|
|
- score = item.getScore(HisFissionDeWeightAvgReadSumRateStrategy.class.getSimpleName())
|
|
|
- * weightService.getWeight(param.getStrategy(), 1,
|
|
|
- HisFissionDeWeightAvgReadSumRateStrategy.class.getSimpleName());
|
|
|
- if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
|
|
|
- score += item.getScore(ViewCountRateStrategy.class.getSimpleName())
|
|
|
- * weightService.getWeight(param.getStrategy(), 1,
|
|
|
- ViewCountRateStrategy.class.getSimpleName());
|
|
|
+ double similarityScore = Math.pow(item.getScore(ScoreStrategyEnum.SIMILARITY.value()),
|
|
|
+ weightService.getWeight(param.getStrategy(), param.getGhId(), index,
|
|
|
+ ScoreStrategyEnum.SIMILARITY.value()));
|
|
|
+ score = item.getScore(ScoreStrategyEnum.HIS_FISSION_DE_WEIGHT_AVG_READ_SUM_RATE.value())
|
|
|
+ * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
|
|
|
+ ScoreStrategyEnum.HIS_FISSION_DE_WEIGHT_AVG_READ_SUM_RATE.value());
|
|
|
+ if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
|
|
|
+ score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value())
|
|
|
+ * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
|
|
|
+ ScoreStrategyEnum.VIEW_COUNT_RATE.value());
|
|
|
}
|
|
|
score = score * similarityScore;
|
|
|
} else if (contentPools[1].equals(item.getContent().getContentPoolType())) {
|
|
|
- score = (item.getScore(SimilarityStrategy.class.getSimpleName())
|
|
|
- * weightService.getWeight(param.getStrategy(), 2,
|
|
|
- SimilarityStrategy.class.getSimpleName()))
|
|
|
- + item.getScore(CategoryStrategy.class.getSimpleName())
|
|
|
- + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
|
|
|
- if (item.getScore(PublishTimesStrategy.class.getSimpleName()) >= 0) {
|
|
|
- score += item.getScore(ViewCountRateStrategy.class.getSimpleName())
|
|
|
- * weightService.getWeight(param.getStrategy(), 2,
|
|
|
- ViewCountRateStrategy.class.getSimpleName());
|
|
|
+ score = (item.getScore(ScoreStrategyEnum.SIMILARITY.value())
|
|
|
+ * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
|
|
|
+ ScoreStrategyEnum.SIMILARITY.value()))
|
|
|
+ + item.getScore(ScoreStrategyEnum.CATEGORY.value())
|
|
|
+ + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
|
|
|
+ if (item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value()) >= 0) {
|
|
|
+ score += item.getScore(ScoreStrategyEnum.VIEW_COUNT_RATE.value())
|
|
|
+ * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
|
|
|
+ ScoreStrategyEnum.VIEW_COUNT_RATE.value());
|
|
|
}
|
|
|
} else {
|
|
|
- score = (item.getScore(SimilarityStrategy.class.getSimpleName())
|
|
|
- * weightService.getWeight(param.getStrategy(), 3,
|
|
|
- SimilarityStrategy.class.getSimpleName()))
|
|
|
- + item.getScore(CategoryStrategy.class.getSimpleName())
|
|
|
- + (item.getScore(AccountPreDistributeStrategy.class.getSimpleName())
|
|
|
- * weightService.getWeight(param.getStrategy(), 3,
|
|
|
- AccountPreDistributeStrategy.class.getSimpleName()))
|
|
|
- + item.getScore(PublishTimesStrategy.class.getSimpleName())
|
|
|
- + item.getScore(FlowCtlDecreaseStrategy.class.getSimpleName());
|
|
|
+ score = (item.getScore(ScoreStrategyEnum.SIMILARITY.value())
|
|
|
+ * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
|
|
|
+ ScoreStrategyEnum.SIMILARITY.value()))
|
|
|
+ + item.getScore(ScoreStrategyEnum.CATEGORY.value())
|
|
|
+ + (item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
|
|
|
+ * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
|
|
|
+ ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value()))
|
|
|
+ + item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
|
|
|
+ + item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
|
|
|
}
|
|
|
c.setScore(score);
|
|
|
c.setHisPublishArticleList(null);
|