Ver código fonte

增加代码注释

sunmingze 1 ano atrás
pai
commit
d22027c8e1

+ 2 - 1
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/framework/merger/StrategyQueue.java

@@ -36,6 +36,7 @@ public abstract class StrategyQueue {
         items = new LinkedList<RankItem>();
         children = new HashMap<String, StrategyQueue>();
 
+        // 自顶向下构建child queue 初始化
         for (String childName : strategyQueueInfo.getChildren()) {
             if (!strategyQueueConfig.getStrategyQueueInfoMap().containsKey(childName)) {
                 LOGGER.error("No config for Child queue [{}]", childName);
@@ -156,7 +157,7 @@ public abstract class StrategyQueue {
         return n;
     }
 
-    // 读取子队列的merge规则并按配比阶段
+    // 读取子队列的merge规则,按队列生成candidate
     protected int simpleCandidateByPercentage(Map<String, Candidate> candidateMap, int recallNum, User user, RecommendRequest requestData, int requestIndex, int expId) {
         int n = 0;
 

+ 1 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/framework/merger/StrategyQueueConfig.java

@@ -114,6 +114,7 @@ public class StrategyQueueConfig {
             mergeQueueInfo.setQueueClass(DEFAULT_STRATEGY_CLASS_NAME);
         }
 
+        // 递归的把child节点放在queue中
         if (conf.hasPath(CHILDREN_STRING)) {
             ConfigObject childrenConf = conf.getObject(CHILDREN_STRING);
             for (ConfigObject.Entry<String, ConfigValue> it : childrenConf.entrySet()) {

+ 0 - 1
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/implement/TopRecommendPipeline.java

@@ -54,7 +54,6 @@ public class TopRecommendPipeline {
         RedisSmartClient client = new RedisSmartClient();
         RedisBackedQueue queueProvider = new RedisBackedQueue(client, 1000L);
 
-
         BaseRecaller recaller = new BaseRecaller(queueProvider);
         List<RankItem> items = recaller.recalling(requestData, userInfo, requestIndex, new ArrayList<Candidate>(candidates.values()));
 

+ 3 - 10
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/implement/candidate/Global24hHotCandidate.java

@@ -28,27 +28,20 @@ public class Global24hHotCandidate extends IndexCandidateQueue {
 
         // index key  video:queue:type=global24h:region=北京:ordering=rov
         QueueName queueName24HGlobal = new QueueName(ItemType, "rov")
-                .addMatch("type", "global24h")
-                .addMatch("region", region);
+                .addMatch("type", "global24h");
         currRecall += addCandidateKey(simplifiedCandidates, queueName24HGlobal, 1, getStrategyQueueInfo().getQueueName());
 
         // index key  video:queue:type=global24h:region=北京:ordering=realplay
         queueName24HGlobal = new QueueName(ItemType, "realplay")
-                .addMatch("type", "global24h")
-                .addMatch("region", region);
+                .addMatch("type", "global24h");
         currRecall += addCandidateKey(simplifiedCandidates, queueName24HGlobal, 1, getStrategyQueueInfo().getQueueName());
 
         // index key  video:queue:type=global24h:region=北京:ordering=str
         queueName24HGlobal = new QueueName(ItemType, "str")
-                .addMatch("type", "global24h")
-                .addMatch("region", region);
+                .addMatch("type", "global24h");
         currRecall += addCandidateKey(simplifiedCandidates, queueName24HGlobal, 1, getStrategyQueueInfo().getQueueName());
 
         // index key  video:queue:type=global24h:region=北京:ordering=realplay_rate
-        queueName24HGlobal = new QueueName(ItemType, "realplay_ratio")
-                .addMatch("type", "global24h")
-                .addMatch("region", region);
-        currRecall += addCandidateKey(simplifiedCandidates, queueName24HGlobal, 1, getStrategyQueueInfo().getQueueName());
 
 
         candidates.putAll(simplifiedCandidates);