|
@@ -53,34 +53,43 @@ public class RegionRealtimeRecallStrategyV1 implements RecallStrategy {
|
|
|
|
|
|
|
|
|
|
long t1 = new Long(System.currentTimeMillis());
|
|
long t1 = new Long(System.currentTimeMillis());
|
|
- int chunkSize = 25;
|
|
|
|
- List<List<Long>> groupedKeys = groupKeys(videoMap, chunkSize);
|
|
|
|
- List<Long> videoids = new ArrayList<>();
|
|
|
|
- for (List<Long> tmp : groupedKeys){
|
|
|
|
- FilterParam filterParam = FilterParamFactory.create(param, tmp);
|
|
|
|
- filterParam.setForceTruncation(10000);
|
|
|
|
- FilterResult filterResult = filterService.filter(filterParam);
|
|
|
|
- if (filterResult != null && CollectionUtils.isNotEmpty(filterResult.getVideoIds())){
|
|
|
|
- videoids.addAll(filterResult.getVideoIds());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+// int chunkSize = 25;
|
|
|
|
+// List<List<Long>> groupedKeys = groupKeys(videoMap, chunkSize);
|
|
|
|
+// List<Long> videoids = new ArrayList<>();
|
|
|
|
+// for (List<Long> tmp : groupedKeys){
|
|
|
|
+// FilterParam filterParam = FilterParamFactory.create(param, tmp);
|
|
|
|
+// filterParam.setForceTruncation(10000);
|
|
|
|
+// filterParam.setConcurrent(true);
|
|
|
|
+// filterParam.setUsePreView(false);
|
|
|
|
+// FilterResult filterResult = filterService.filter(filterParam);
|
|
|
|
+// if (filterResult != null && CollectionUtils.isNotEmpty(filterResult.getVideoIds())){
|
|
|
|
+// videoids.addAll(filterResult.getVideoIds());
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+ FilterParam filterParam = FilterParamFactory.create(param, Lists.newArrayList(videoMap.keySet()));
|
|
|
|
+ filterParam.setForceTruncation(10000);
|
|
|
|
+ filterParam.setConcurrent(true);
|
|
|
|
+ filterParam.setNotUsePreView(true);
|
|
|
|
+ FilterResult filterResult = filterService.filter(filterParam);
|
|
long t2 = new Long(System.currentTimeMillis());
|
|
long t2 = new Long(System.currentTimeMillis());
|
|
JSONObject obj = new JSONObject();
|
|
JSONObject obj = new JSONObject();
|
|
obj.put("name", "RegionRealtimeRecallStrategyV1");
|
|
obj.put("name", "RegionRealtimeRecallStrategyV1");
|
|
obj.put("filter_time", t2-t1);
|
|
obj.put("filter_time", t2-t1);
|
|
obj.put("provinceCn", provinceCn);
|
|
obj.put("provinceCn", provinceCn);
|
|
obj.put("sizeOld", videoMap.size());
|
|
obj.put("sizeOld", videoMap.size());
|
|
- obj.put("sizeNew", videoids.size());
|
|
|
|
- log.info(obj.toString());
|
|
|
|
List<Video> videosResult = new ArrayList<>();
|
|
List<Video> videosResult = new ArrayList<>();
|
|
- videoids.stream().forEach(vid -> {
|
|
|
|
- Video video = new Video();
|
|
|
|
- video.setVideoId(vid);
|
|
|
|
- video.setAbCode(param.getAbCode());
|
|
|
|
- video.setRovScore(videoMap.get(vid));
|
|
|
|
- video.setPushFrom(pushFrom());
|
|
|
|
- videosResult.add(video);
|
|
|
|
- });
|
|
|
|
|
|
+ if (filterResult != null && CollectionUtils.isNotEmpty(filterResult.getVideoIds())) {
|
|
|
|
+ obj.put("sizeNew", filterResult.getVideoIds().size());
|
|
|
|
+ filterResult.getVideoIds().stream().forEach(vid -> {
|
|
|
|
+ Video video = new Video();
|
|
|
|
+ video.setVideoId(vid);
|
|
|
|
+ video.setAbCode(param.getAbCode());
|
|
|
|
+ video.setRovScore(videoMap.get(vid));
|
|
|
|
+ video.setPushFrom(pushFrom());
|
|
|
|
+ videosResult.add(video);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ log.info(obj.toString());
|
|
Collections.sort(videosResult, Comparator.comparingDouble(o -> -o.getRovScore()));
|
|
Collections.sort(videosResult, Comparator.comparingDouble(o -> -o.getRovScore()));
|
|
return videosResult;
|
|
return videosResult;
|
|
}
|
|
}
|