Просмотр исходного кода

对齐数据组 demand_strategy 改名: 先验需求/先验需求-场景/后验需求 -> 人群需求/人群需求-场景/优质相似

prod content_platform_demand_video 的 demand_strategy 取值已被数据组重命名,
旧值 0 行,导致 prior/posterior/priorScene 三路全部返回空。
同步更新代码常量 + Swagger doc + recommend-ordering.md。
刘立冬 9 часов назад
Родитель
Сommit
a51f44c599

+ 1 - 1
api-module/src/main/java/com/tzld/piaoquan/api/model/param/contentplatform/VideoContentListParam.java

@@ -19,7 +19,7 @@ public class VideoContentListParam extends PageParam {
     @ApiModelProperty(value = "排序 0-平台推荐 1-行业裂变率 2-本渠道裂变率 3-推荐指数")
     private Integer sort = 0;
 
-    @ApiModelProperty(value = "数据来源: prior-先验需求 / posterior-后验需求 / hot-全局热门 / 空-全部穿插")
+    @ApiModelProperty(value = "数据来源: prior-人群需求 / posterior-优质相似 / hot-全局热门 / 空-全部穿插")
     private String source;
 
     @ApiModelProperty(value = "公众号名称(对应 demand.channel_level3),仅 prior/posterior 路使用,无数据时退化为渠道粒度")

+ 8 - 8
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java

@@ -611,9 +611,9 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     private static final int DEMAND_CANDIDATE_LIMIT = 10000;
     private static final int HOT_CANDIDATE_LIMIT = 10000;
     private static final int TOP_K_PER_DEMAND = 3;
-    private static final String DEMAND_STRATEGY_PRIOR = "先验需求";
-    private static final String DEMAND_STRATEGY_PRIOR_SCENE = "先验需求-场景";
-    private static final String DEMAND_STRATEGY_POSTERIOR = "后验需求";
+    private static final String DEMAND_STRATEGY_PRIOR = "人群需求";
+    private static final String DEMAND_STRATEGY_PRIOR_SCENE = "人群需求-场景";
+    private static final String DEMAND_STRATEGY_POSTERIOR = "优质相似";
     private static final String PRIOR_PREMIUM_DIMENSION = "传播的头部";
     private static final double PRIOR_GROUP_KEEP_RATIO = 0.5;
     private static final String POSTERIOR_FILTER_ABS_LIKE = "绝对高效率%";
@@ -644,7 +644,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     }
 
     /**
-     * 单一来源分页:与穿插使用同一套候选构建逻辑(先验/后验各 2 阶段、组内 score top K),
+     * 单一来源分页:与穿插使用同一套候选构建逻辑(人群需求/优质相似各 2 阶段、组内 score top K),
      * 再按 pageNum/pageSize 在内存中分页。totalSize = 去重后总数。
      */
     private Page<VideoContentItemVO> getSingleSourcePage(VideoContentListParam param, ContentPlatformAccount user, String source) {
@@ -653,7 +653,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         }
         List<VideoContentItemVO> list;
         if (SOURCE_PRIOR.equals(source)) {
-            // 粉丝喜欢 = 先验需求-场景 与 先验需求 严格 1:1 穿插,场景先出,prior 用完顺位补齐
+            // 粉丝喜欢 = 人群需求-场景 与 人群需求 严格 1:1 穿插,场景先出,prior 用完顺位补齐
             List<VideoContentItemVO> scene = fetchPriorSceneCandidates(param, user, DEMAND_CANDIDATE_LIMIT);
             List<VideoContentItemVO> prior = fetchPriorCandidates(param, user, DEMAND_CANDIDATE_LIMIT);
             list = interleavePriorWithScene(scene, prior);
@@ -827,7 +827,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     }
 
     /**
-     * 先验需求-场景池: demand_strategy='先验需求-场景'。
+     * 人群需求-场景池: demand_strategy='人群需求-场景'。
      * 退化策略: ghName 非空且查不到数据 → 退回渠道粒度(不限 channel_level3)。
      * 后处理:
      *   1. 同 video_id 仅保留 total_rov 最大的代表行(利用 SQL 已按 total_rov DESC, score DESC 排好,首次即最大)
@@ -874,7 +874,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     }
 
     /**
-     * 先验池:只取 dimension='传播的头部' 的行。
+     * 人群需求池(prior):只取 dimension='传播的头部' 的行。
      * total_rov 在 prior 池里代表「群体对(point_type, standard_element)这个特征的需求强度」,
      * 不同渠道分布差异大,所以按 channel 内 total_rov 分位保留 top 50% 特征组,
      * 过滤掉群体根本不爱的弱需求题材。
@@ -946,7 +946,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     }
 
     /**
-     * 后验池:A 段 "绝对高效率" → B 段 "相对裂变率"。
+     * 优质相似池(posterior):A 段 "绝对高效率" → B 段 "相对裂变率"。
      * 每段按 demand_content_id 分组,组按 total_rov DESC、组内 score DESC 取前 K;段间拼接 + video_id 去重。
      */
     private List<VideoContentItemVO> fetchPosteriorCandidates(VideoContentListParam param, ContentPlatformAccount user, int limit) {

+ 23 - 21
docs/recommend-ordering.md

@@ -2,7 +2,9 @@
 
 > 接口:`POST /contentPlatform/plan/videoContentList`
 > 入口:`ContentPlatformPlanServiceImpl.getVideoContentList`
-> 数据源:`content_platform_demand_video`(先验/后验/先验-场景)+ `content_platform_video`(全局热门)
+> 数据源:`content_platform_demand_video`(人群需求/优质相似/人群需求-场景)+ `content_platform_video`(全局热门)
+>
+> 数据组重命名:旧值「先验需求/后验需求/先验需求-场景」→ 新值「人群需求/优质相似/人群需求-场景」(2026-05 改名,本文档已对齐新值)。
 >
 > 适用:当前分支 `cooperation_video_candidate_pool_improved_lld_0509`(含 commit `2860bdce`)。
 
@@ -29,14 +31,14 @@ source 空(默认)  ──────►  四路随机穿插 (getInterleave
 | `DEMAND_CANDIDATE_LIMIT` | 10000 | 每个 demand 池最大候选条数 |
 | `HOT_CANDIDATE_LIMIT` | 10000 | hot 池候选条数 |
 | `TOP_K_PER_DEMAND` | 3 | demand 池组内取前 K |
-| `DEMAND_STRATEGY_PRIOR` | `"先验需求"` | 先验池过滤值 |
-| `DEMAND_STRATEGY_PRIOR_SCENE` | `"先验需求-场景"` | 场景池过滤值 |
-| `DEMAND_STRATEGY_POSTERIOR` | `"后验需求"` | 后验池过滤值 |
-| `PRIOR_PREMIUM_DIMENSION` | `"传播的头部"` | 先验池 dimension 强过滤 |
-| `PRIOR_GROUP_KEEP_RATIO` | `0.5` | 先验池"特征组"按 total_rov 分位保留比例 |
-| `POSTERIOR_FILTER_ABS_LIKE` | `"绝对高效率%"` | 后验池 A 段 `demand_filter_sort_strategy` LIKE |
-| `POSTERIOR_FILTER_REL_LIKE` | `"相对裂变率%"` | 后验池 B 段 `demand_filter_sort_strategy` LIKE |
-| `POSTERIOR_DRIVE_DIMENSION_TIME` | `"昨日"` | 后验池强制 `drive_dimension_time` |
+| `DEMAND_STRATEGY_PRIOR` | `"人群需求"` | 人群需求池过滤值(prior,旧名「先验需求」) |
+| `DEMAND_STRATEGY_PRIOR_SCENE` | `"人群需求-场景"` | 场景池过滤值(旧名「先验需求-场景」) |
+| `DEMAND_STRATEGY_POSTERIOR` | `"优质相似"` | 优质相似池过滤值(posterior,旧名「后验需求」) |
+| `PRIOR_PREMIUM_DIMENSION` | `"传播的头部"` | prior 池 dimension 强过滤 |
+| `PRIOR_GROUP_KEEP_RATIO` | `0.5` | prior 池"特征组"按 total_rov 分位保留比例 |
+| `POSTERIOR_FILTER_ABS_LIKE` | `"绝对高效率%"` | posterior 池 A 段 `demand_filter_sort_strategy` LIKE |
+| `POSTERIOR_FILTER_REL_LIKE` | `"相对裂变率%"` | posterior 池 B 段 `demand_filter_sort_strategy` LIKE |
+| `POSTERIOR_DRIVE_DIMENSION_TIME` | `"昨日"` | posterior 池强制 `drive_dimension_time` |
 
 公共强过滤(所有 demand 池 SQL):`dt = max(dt)` AND `status = 1` AND `crowd_segment = user.channel`。
 
@@ -46,13 +48,13 @@ source 空(默认)  ──────►  四路随机穿插 (getInterleave
 
 ### 3.1 `fetchPriorSceneCandidates`(场景池)
 
-**目的:用户所属 channel 在"场景"维度命中的先验,按视频近 7 日表现(rov)排序。**
+**目的:用户所属 channel 在"场景"维度命中的人群需求-场景行,按视频近 7 日表现(rov)排序。**
 
 ```sql
 SELECT ... FROM content_platform_demand_video
 WHERE dt=:maxDt AND status=1
   AND crowd_segment=:userChannel
-  AND demand_strategy='先验需求-场景'
+  AND demand_strategy='人群需求-场景'
   AND channel_level3=:ghName        -- 若传入
 ORDER BY total_rov DESC, score DESC
 LIMIT 10000
@@ -71,14 +73,14 @@ LIMIT 10000
 
 ---
 
-### 3.2 `fetchPriorCandidates`(先验池
+### 3.2 `fetchPriorCandidates`(人群需求池,prior
 
-**目的:先验需求里,只取 `dimension='传播的头部'` 维度,并按 channel 内"特征需求强度"分位裁掉弱题材。**
+**目的:人群需求里,只取 `dimension='传播的头部'` 维度,并按 channel 内"特征需求强度"分位裁掉弱题材。**
 
 单段查询:
 
 ```sql
-SELECT ... WHERE ... AND demand_strategy='先验需求' AND dimension='传播的头部' ...
+SELECT ... WHERE ... AND demand_strategy='人群需求' AND dimension='传播的头部' ...
 ORDER BY total_rov DESC, score DESC LIMIT 30000
 ```
 
@@ -104,15 +106,15 @@ ORDER BY total_rov DESC, score DESC LIMIT 30000
 
 ---
 
-### 3.3 `fetchPosteriorCandidates`(后验池
+### 3.3 `fetchPosteriorCandidates`(优质相似池,posterior
 
-**目的:后验需求里,"昨日"驱动的"绝对高效率"先出,再出"相对裂变率"。**
+**目的:优质相似里,"昨日"驱动的"绝对高效率"先出,再出"相对裂变率"。**
 
 A、B 两段独立查询:
 
 ```sql
 -- A 段: demand_filter_sort_strategy LIKE '绝对高效率%'
-SELECT ... WHERE ... AND demand_strategy='后验需求'
+SELECT ... WHERE ... AND demand_strategy='优质相似'
   AND demand_filter_sort_strategy LIKE '绝对高效率%'
   AND drive_dimension_time='昨日'
   AND (title IS NULL OR demand_content_title IS NULL OR title <> demand_content_title)
@@ -181,7 +183,7 @@ hot        → 标 source='hot'
 
 ### 排序稳定性
 - 同一用户同一天,所有分页之间顺序一致
-- `priorScene` / `prior` / `posterior` 内部相对顺序保留(场景按视频 rov;先验/后验按组 total_rov + 组内 score),随机只影响"哪一池先出"
+- `priorScene` / `prior` / `posterior` 内部相对顺序保留(场景按视频 rov;prior/posterior 按组 total_rov + 组内 score),随机只影响"哪一池先出"
 
 ---
 
@@ -222,7 +224,7 @@ list = fetchPosteriorCandidates(...)   // 顺序 = 绝对高效率段 → 相对
 
 | `source` | 含义 | 数据来源 | 浮层 demand 字段 |
 |---|---|---|---|
-| `prior` | 粉丝喜欢(场景 + 先验头部 + 先验其他) | `content_platform_demand_video` | 有完整字段,可看 `demandStrategy` 区分 |
+| `prior` | 粉丝喜欢(人群需求-场景 + 人群需求-头部) | `content_platform_demand_video` | 有完整字段,可看 `demandStrategy` 区分 |
 | `posterior` | 已发优质相似 | `content_platform_demand_video` | 有完整字段 |
 | `hot` | 全局热门 | `content_platform_video` | 只有基础字段(demand 相关字段为空) |
 
@@ -269,8 +271,8 @@ priorScene(10000)    prior(10000)  posterior(10000)         hot(10000)
 | 单源 hot | `ContentPlatformPlanServiceImpl.java:698` |
 | 四路穿插 | `ContentPlatformPlanServiceImpl.java:743` |
 | 场景池 fetcher | `ContentPlatformPlanServiceImpl.java:812` |
-| 先验池 fetcher | `ContentPlatformPlanServiceImpl.java:840` |
-| 后验池 fetcher | `ContentPlatformPlanServiceImpl.java:875` |
+| 人群需求池 fetcher (prior) | `ContentPlatformPlanServiceImpl.java:840` |
+| 优质相似池 fetcher (posterior) | `ContentPlatformPlanServiceImpl.java:875` |
 | `groupAndTopK` 通用排序 | `ContentPlatformPlanServiceImpl.java:912` |
 | 段间拼接 + 去重 | `ContentPlatformPlanServiceImpl.java:956` |
 | 热门池 fetcher | `ContentPlatformPlanServiceImpl.java:976` |