|
@@ -1,15 +1,14 @@
|
|
|
package com.tzld.longarticle.recommend.server.service.recommend.rank.strategy;
|
|
|
|
|
|
|
|
|
+import com.tzld.longarticle.recommend.server.common.enums.recommend.RankStrategyEnum;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.recommend.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;
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.config.AccountContentPoolConfigService;
|
|
|
-import com.tzld.longarticle.recommend.server.service.recommend.rank.RankItem;
|
|
|
-import com.tzld.longarticle.recommend.server.service.recommend.rank.RankParam;
|
|
|
-import com.tzld.longarticle.recommend.server.service.recommend.rank.RankResult;
|
|
|
-import com.tzld.longarticle.recommend.server.service.recommend.rank.RankStrategy;
|
|
|
+import com.tzld.longarticle.recommend.server.service.recommend.config.StrategyIndexScoreWeightService;
|
|
|
+import com.tzld.longarticle.recommend.server.service.recommend.rank.*;
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.score.AccountIndexReplacePoolConfig;
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.score.ScoreResult;
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.score.ScoreService;
|
|
@@ -35,6 +34,8 @@ public class RankV8Strategy implements RankStrategy {
|
|
|
private AccountContentPoolConfigService accountContentPoolConfigService;
|
|
|
@Autowired
|
|
|
private ArticleRepository articleRepository;
|
|
|
+ @Autowired
|
|
|
+ private StrategyIndexScoreWeightService weightService;
|
|
|
|
|
|
public RankResult rank(RankParam param) {
|
|
|
List<Content> result = new ArrayList<>();
|
|
@@ -51,9 +52,12 @@ public class RankV8Strategy 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())) {
|
|
|
score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
|
|
|
+ item.getScore(ScoreStrategyEnum.CATEGORY.value())
|
|
|
+ * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
|
|
|
+ ScoreStrategyEnum.CATEGORY.value())
|
|
|
+ item.getScore(ScoreStrategyEnum.FLOW_CTL_DECREASE.value());
|
|
|
score += item.getScore(ScoreStrategyEnum.HIS_FISSION_AVG_READ_RATE_RATE.value());
|
|
|
} else if (contentPools[1].equals(item.getContent().getContentPoolType())) {
|
|
@@ -66,6 +70,8 @@ public class RankV8Strategy implements RankStrategy {
|
|
|
} else {
|
|
|
score = item.getScore(ScoreStrategyEnum.SIMILARITY.value())
|
|
|
+ item.getScore(ScoreStrategyEnum.CATEGORY.value())
|
|
|
+ * weightService.getWeight(param.getStrategy(), param.getGhId(), index,
|
|
|
+ ScoreStrategyEnum.CATEGORY.value())
|
|
|
+ item.getScore(ScoreStrategyEnum.ACCOUNT_PRE_DISTRIBUTE.value())
|
|
|
+ item.getScore(ScoreStrategyEnum.PUBLISH_TIMES.value())
|
|
|
+ item.getScore(ScoreStrategyEnum.CRAWLER_DAYS_DECREASE_STRATEGY.value())
|
|
@@ -98,6 +104,7 @@ public class RankV8Strategy implements RankStrategy {
|
|
|
|
|
|
// 头
|
|
|
List<Content> pool1 = contentMap.get(contentPools[0]);
|
|
|
+ RankService.printSortLog(RankStrategyEnum.ArticleRankV8.getStrategy(), param.getAccountName(), pool1);
|
|
|
if (CollectionUtils.isNotEmpty(pool1)) {
|
|
|
result.add(pool1.get(0));
|
|
|
} else {
|