|
@@ -6,11 +6,11 @@ import com.tzld.longarticle.recommend.server.service.AccountContentPoolConfigSer
|
|
|
import com.tzld.longarticle.recommend.server.service.score.ScoreParam;
|
|
|
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.ScoreStrategy;
|
|
|
import com.tzld.longarticle.recommend.server.service.score.strategy.ContentPoolStrategy;
|
|
|
import com.tzld.longarticle.recommend.server.service.score.strategy.SimilarityStrategy;
|
|
|
import com.tzld.longarticle.recommend.server.service.score.strategy.ViewCountStrategy;
|
|
|
import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
|
|
|
+import com.tzld.longarticle.recommend.server.util.JSONUtils;
|
|
|
import com.tzld.longarticle.recommend.server.util.TitleSimilarCheckUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
@@ -34,14 +34,17 @@ public class RankService {
|
|
|
|
|
|
public RankResult rank(RankParam param) {
|
|
|
|
|
|
+ log.info("RankParam {}", JSONUtils.toJson(param));
|
|
|
ScoreResult scoreResult = scoreService.score(convertToScoreParam(param));
|
|
|
- Map<String, Map<Class<? extends ScoreStrategy>, Double>> scoreMap = scoreResult.getScoreMap();
|
|
|
+ log.info("ScoreResult {}", JSONUtils.toJson(scoreResult));
|
|
|
+
|
|
|
+ Map<String, Map<String, Double>> scoreMap = scoreResult.getScoreMap();
|
|
|
|
|
|
List<RankItem> items = CommonCollectionUtils.toList(param.getContents(), c -> {
|
|
|
- Map<Class<? extends ScoreStrategy>, Double> map = scoreMap.get(c.getId());
|
|
|
- double score = 1 * map.getOrDefault(SimilarityStrategy.class, 0.0)
|
|
|
- + 10 * map.getOrDefault(ViewCountStrategy.class, 0.0)
|
|
|
- + 100 * map.getOrDefault(ContentPoolStrategy.class, 0.0);
|
|
|
+ Map<String, Double> map = scoreMap.get(c.getId());
|
|
|
+ double score = 1 * map.getOrDefault(SimilarityStrategy.class.getSimpleName(), 0.0)
|
|
|
+ + 10 * map.getOrDefault(ViewCountStrategy.class.getSimpleName(), 0.0)
|
|
|
+ + 100 * map.getOrDefault(ContentPoolStrategy.class.getSimpleName(), 0.0);
|
|
|
|
|
|
RankItem item = new RankItem();
|
|
|
item.setContent(c);
|