|
@@ -2,7 +2,6 @@ package com.tzld.piaoquan.recommend.server.implement;
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
|
import com.google.common.base.Stopwatch;
|
|
|
import com.google.common.reflect.TypeToken;
|
|
|
import com.tzld.piaoquan.recommend.server.common.base.RankItem;
|
|
@@ -31,6 +30,7 @@ import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.PostConstruct;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -39,22 +39,20 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class TopRecommendPipeline {
|
|
|
|
|
|
-
|
|
|
- @ApolloJsonValue("${rank.score.merge.weight:}")
|
|
|
- private Map<String, Double> mergeWeight;
|
|
|
-
|
|
|
private static final Logger log = LoggerFactory.getLogger(TopRecommendPipeline.class);
|
|
|
|
|
|
- public static final String FILTER_CONF = "filter_config.conf";
|
|
|
public static final String MERGE_CONF = "merge_config.conf";
|
|
|
|
|
|
- public static final String PREFIX = "";
|
|
|
-
|
|
|
-
|
|
|
@Resource
|
|
|
private RedisSmartClient client;
|
|
|
@Resource
|
|
|
public RedisTemplate<String, String> redisTemplate;
|
|
|
+ private RedisBackedQueue queueProvider;
|
|
|
+
|
|
|
+ @PostConstruct
|
|
|
+ public void init() {
|
|
|
+ queueProvider = new RedisBackedQueue(client, 15 * 60 * 1000L);
|
|
|
+ }
|
|
|
|
|
|
public List<Video> feeds(final RecommendRequest requestData,
|
|
|
final int requestIndex,
|
|
@@ -137,7 +135,6 @@ public class TopRecommendPipeline {
|
|
|
|
|
|
// Step 4: Recalling & Basic Scoring
|
|
|
stopwatch.reset().start();
|
|
|
- RedisBackedQueue queueProvider = new RedisBackedQueue(client, 1000L);
|
|
|
BaseRecaller recaller = new BaseRecaller(queueProvider);
|
|
|
List<RankItem> items = recaller.recalling(requestData, userInfo, requestIndex, new ArrayList<>(candidates.values()));
|
|
|
if (logPrint) {
|