wangyunpeng 11 月之前
父节点
当前提交
84beecb725

+ 1 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/Content.java

@@ -30,7 +30,7 @@ public class Content {
      */
     private String contentPoolType; // 内容池类别
     private String crawlerChannelContentId; // 抓取内容channelContentId
-    private String category; // 品类
+    private List<String> category; // 品类
     private String crawlerLink;
     private String crawlerTitle;
     private String crawlerCoverUrl;

+ 1 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/RecommendService.java

@@ -172,7 +172,7 @@ public class RecommendService {
             sortLog.setTitle(content.getTitle());
             sortLog.setIndex(i);
             sortLog.setIndexAvgCount(accountIndexAvgViewCountService.getAvgReadCount(param.getGhId(), i));
-            sortLog.setCategory(content.getCategory());
+            sortLog.setCategory(JSONObject.toJSONString(content.getCategory()));
             sortLog.setStrategy(param.getStrategy());
             sortLog.setCreateTimestamp(System.currentTimeMillis());
             publishSortLogSaveList.add(sortLog);

+ 2 - 2
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recall/RecallService.java

@@ -134,8 +134,8 @@ public class RecallService implements ApplicationContextAware {
         if (CollectionUtils.isEmpty(categoryList)) {
             return;
         }
-        Map<String, String> categoryMap = categoryList.stream().collect(
-                Collectors.toMap(CrawlerMetaArticle::getUniqueIndex, CrawlerMetaArticle::getCategory));
+        Map<String, List<String>> categoryMap = categoryList.stream().collect(Collectors.groupingBy(CrawlerMetaArticle::getChannelContentId,
+                Collectors.mapping(CrawlerMetaArticle::getCategory, Collectors.toList())));
         for (Content content : contentList) {
             String md5 = articleMd5Map.get(content.getId());
             content.setCategory(categoryMap.get(md5));

+ 1 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/score/strategy/CategoryStrategy.java

@@ -51,7 +51,7 @@ public class CategoryStrategy implements ScoreStrategy {
                     if (Objects.nonNull(categoryWeightConfig)) {
                         List<AccountCategoryWeightConfig.CategoryWeight> categoryWeightList = categoryWeightConfig.getCategoryWeightList();
                         for (AccountCategoryWeightConfig.CategoryWeight categoryWeight : categoryWeightList) {
-                            if (categoryWeight.getCategory().equals(content.getCategory())) {
+                            if (content.getCategory().contains(categoryWeight.getCategory())) {
                                 score.setScore(categoryWeight.getWeight());
                             }
                         }