|
@@ -45,8 +45,20 @@ public abstract class AbstractRegionRecallStrategy implements RecallStrategy {
|
|
|
String poolKey = "";
|
|
|
|
|
|
// TODO 整段逻辑很奇怪,需要重新理解
|
|
|
+ /**
|
|
|
+ * TODO 问题:召回时按照降序获取idx,再降序取数据,但是融合排序实验会按照score重新排序,可能导致数据被跳过
|
|
|
+ * 比如:地域 [[1, 0.1],[2, 0.2],[3, 0.3][4, 0.4]]
|
|
|
+ * 排序实验 [[1, 0.9],[2, 0.8],[3, 0.7][4, 0.6]]
|
|
|
+ *
|
|
|
+ * 返回2个视频是 1和2,但是会记录最后一个视频的id是2,那么当地域再次召回时,会召回1,不会召回3、4
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+ // recordKey: 每小时生成一个召回源,用来决定用哪个召回源
|
|
|
+ // poolKey: 召回源的key
|
|
|
+ // lastVideoLKey: 上次返回的最后一个视频
|
|
|
String record = redisTemplate.opsForValue().get(recordKey);
|
|
|
- log.info("recall recordKey:[{}], record:[{}]", recordKey, record);
|
|
|
if (StringUtils.isNotBlank(record)) {
|
|
|
Map<String, String> recordMap = JSONUtils.fromJson(record, new TypeToken<Map<String, String>>() {
|
|
|
}, Collections.emptyMap());
|
|
@@ -78,7 +90,7 @@ public abstract class AbstractRegionRecallStrategy implements RecallStrategy {
|
|
|
redisTemplate.delete(lastVideoKey);
|
|
|
poolKey = updateLastVideoRecord(recordKey, param);
|
|
|
}
|
|
|
- log.info("recall poolKey={}", poolKey);
|
|
|
+ log.info("recall recordKey={}, record={}, poolKey={}, idx={}, ", recordKey, record, poolKey, idx);
|
|
|
if (StringUtils.isBlank(poolKey)) {
|
|
|
return null;
|
|
|
}
|
|
@@ -126,7 +138,7 @@ public abstract class AbstractRegionRecallStrategy implements RecallStrategy {
|
|
|
Collections.sort(results, Comparator.comparingDouble(o -> -o.getRovScore()));
|
|
|
|
|
|
if (StringUtils.isNotBlank(lastVideoId)
|
|
|
- && CollectionUtils.isNotEmpty(results)
|
|
|
+ && CollectionUtils.isEmpty(results)
|
|
|
&& StringUtils.isNotBlank(param.getMid())) {
|
|
|
// 召回数据不为空 & 过滤后结果为空 & mid不为空时,更新召回获取的末位视频id记录到定位的key中
|
|
|
redisTemplate.opsForValue().set(lastVideoKey, lastVideoId, 2, TimeUnit.HOURS);
|