|
@@ -735,7 +735,7 @@ public class VideoSearchServiceImpl implements VideoSearchService {
|
|
|
|
|
|
|
|
if (withDetail) {
|
|
if (withDetail) {
|
|
|
// 从 Redis 获取视频基础信息并填充到结果中
|
|
// 从 Redis 获取视频基础信息并填充到结果中
|
|
|
- enrichVideoDetail(result);
|
|
|
|
|
|
|
+ enrichVideoDetail(result, param.getDays());
|
|
|
// 从 Redis 获取视频解构(选题 + 高价值实质点)并填充
|
|
// 从 Redis 获取视频解构(选题 + 高价值实质点)并填充
|
|
|
enrichDeconstruct(result);
|
|
enrichDeconstruct(result);
|
|
|
}
|
|
}
|
|
@@ -760,7 +760,7 @@ public class VideoSearchServiceImpl implements VideoSearchService {
|
|
|
result.add(new VideoMatchResult(configCode, match.getVideoId(), match.getScore(), match.getText()));
|
|
result.add(new VideoMatchResult(configCode, match.getVideoId(), match.getScore(), match.getText()));
|
|
|
}
|
|
}
|
|
|
// 填充视频详情
|
|
// 填充视频详情
|
|
|
- enrichVideoDetail(result);
|
|
|
|
|
|
|
+ enrichVideoDetail(result, param.getDays());
|
|
|
// 填充视频解构
|
|
// 填充视频解构
|
|
|
enrichDeconstruct(result);
|
|
enrichDeconstruct(result);
|
|
|
return result;
|
|
return result;
|
|
@@ -1089,15 +1089,17 @@ public class VideoSearchServiceImpl implements VideoSearchService {
|
|
|
* 根据 Apollo 配置 video.detail.metrics.days 读取对应日期维度的 Redis key
|
|
* 根据 Apollo 配置 video.detail.metrics.days 读取对应日期维度的 Redis key
|
|
|
* key格式: video:detail:{days}d:{videoId}
|
|
* key格式: video:detail:{days}d:{videoId}
|
|
|
*/
|
|
*/
|
|
|
- private void enrichVideoDetail(List<VideoMatchResult> results) {
|
|
|
|
|
|
|
+ private void enrichVideoDetail(List<VideoMatchResult> results, Integer days) {
|
|
|
if (results == null || results.isEmpty()) {
|
|
if (results == null || results.isEmpty()) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ int effectiveDays = days != null ? days : metricsDays;
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
- // 根据 Apollo 配置构建对应日期维度的 Redis keys
|
|
|
|
|
|
|
+ // 根据传入 days 或 Apollo 配置构建对应日期维度的 Redis keys
|
|
|
List<String> keys = results.stream()
|
|
List<String> keys = results.stream()
|
|
|
- .map(r -> VectorConstants.VIDEO_DETAIL_DAYS_KEY_PREFIX + metricsDays + "d:" + r.getVideoId())
|
|
|
|
|
|
|
+ .map(r -> VectorConstants.VIDEO_DETAIL_DAYS_KEY_PREFIX + effectiveDays + "d:" + r.getVideoId())
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> values = redisUtils.mGet(keys);
|
|
List<String> values = redisUtils.mGet(keys);
|
|
@@ -1403,6 +1405,7 @@ public class VideoSearchServiceImpl implements VideoSearchService {
|
|
|
matchParam.setQueryText(param.getQueryText());
|
|
matchParam.setQueryText(param.getQueryText());
|
|
|
matchParam.setQueryVector(param.getQueryVector());
|
|
matchParam.setQueryVector(param.getQueryVector());
|
|
|
matchParam.setTopN(param.getTopN() != null && param.getTopN() > 0 ? param.getTopN() : 10);
|
|
matchParam.setTopN(param.getTopN() != null && param.getTopN() > 0 ? param.getTopN() : 10);
|
|
|
|
|
+ matchParam.setDays(param.getDays());
|
|
|
|
|
|
|
|
List<VideoMatchResult> rawMatches = matchTopNVideo(matchParam, true);
|
|
List<VideoMatchResult> rawMatches = matchTopNVideo(matchParam, true);
|
|
|
if (rawMatches == null || rawMatches.isEmpty()) {
|
|
if (rawMatches == null || rawMatches.isEmpty()) {
|
|
@@ -1515,6 +1518,11 @@ public class VideoSearchServiceImpl implements VideoSearchService {
|
|
|
return vo;
|
|
return vo;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Integer> getSupportedDateRanges() {
|
|
|
|
|
+ return VectorConstants.SUPPORTED_DATE_RANGES;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public PageResult<ChannelDemandMatchVO> queryDemandMatchResult(ChannelDemandMatchQueryParam param) {
|
|
public PageResult<ChannelDemandMatchVO> queryDemandMatchResult(ChannelDemandMatchQueryParam param) {
|
|
|
int pageNum = (param.getPageNum() != null && param.getPageNum() > 0) ? param.getPageNum() : 1;
|
|
int pageNum = (param.getPageNum() != null && param.getPageNum() > 0) ? param.getPageNum() : 1;
|