feat(scripts): identity-reevaluate with --rollback-wrong; docs for ID-2
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
03de030371
commit
42e08b30dc
4 files changed
+378
-1
No files matched your search
@@ -22,7 +22,13 @@
|
||||
| `new_title_rule` | 有已发布、开启 `newTitle` 且有有效持续授权的获取策略,资源类型在规则的 `mediaKinds` 内,标题年份(若有)不早于窗口能覆盖的年份 |
|
||||
|
||||
都不满足:只进池,`reason = unmatched`,不查 TMDB,不开待处理。
|
||||
3. 查了 TMDB 的,走原来的 `domain.resolveIdentity`:auto 建档 / 关联并发 `release.resolved`;否则进池。
|
||||
3. 查了 TMDB 的,召回 TMDB 候选(`recallTmdbCandidates`:中文名 → 英文名,按类型单语言搜索,标题对不上的按年份相近度拉前几个详情比对别名 / 译名),
|
||||
交给 `domain.resolveIdentity` 打分:auto 建档 / 关联并发 `release.resolved`;否则进池。打分规则与 MP 的对照见
|
||||
`docs/porting/moviepilot-identity-match.md`(ID-2)。
|
||||
4. 自动绑定时把站点标题登记为作品别名,只在标题精确命中(或别名命中且另一种文字的名称也命中)时登记,分类词 / 单字 / 停用词不登记。
|
||||
|
||||
标题更新(RSS 标题与列表标题不同、站点改标题):按新标题重新解析,发 `release.observed(isNew=false)`,以 `force` 重新识别
|
||||
(已识别的也不短路,触发来源仍是 observed);重新识别不能确认时撤销原自动绑定、进池。人工锁定的不动。
|
||||
|
||||
任务输入 `trigger` 缺省:`force` 为 true 视为 `review`(池复查),否则 `observed`。
|
||||
搜索模块想让搜索结果直接识别,入队 `resolveObservation` 时传 `trigger: "search"`(目前搜索结果经 `release.observed` 进来,
|
||||
@@ -75,6 +81,24 @@
|
||||
|
||||
需要重建镜像 / 重启 api + worker 才生效(迁移随启动执行)。
|
||||
|
||||
## 规则更新后的存量重评(ID-2,`scripts/identity-reevaluate.ts`)
|
||||
|
||||
匹配规则更新(新镜像已部署、api + worker 已重启)后,用这个脚本处理存量。缺省只读,加 `--apply` 才改库;DATABASE_URL 必须显式给出。
|
||||
|
||||
```sh
|
||||
# 用户栈的 PG 不对宿主暴露端口:取容器 IP,密码取栈的 .env
|
||||
PGIP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' umt-postgres-1)
|
||||
DATABASE_URL=postgres://umt:<密码>@$PGIP:5432/umt deno run -A scripts/identity-reevaluate.ts --rollback-wrong # 先看清单
|
||||
DATABASE_URL=postgres://umt:<密码>@$PGIP:5432/umt deno run -A scripts/identity-reevaluate.ts --rollback-wrong --apply # 确认后执行
|
||||
```
|
||||
|
||||
- 待识别事项:列出 open 的 `identity_ambiguous` 成员,按新解析规则给出预估(只用池里存的候选,不查 TMDB);`--apply` 把这些池条目排入立即复查,
|
||||
由运行中的服务按新规则重新识别——能自动确认的绑定作品、建映射,并从合并事项摘除(组空即关闭)。
|
||||
- `--rollback-wrong`:找站点来源的分类词 / 通用词别名(例如「电视剧」),对挂着它的作品用新解析 + 作品自身名称(主标题 / 原标题 / 非站点来源别名)
|
||||
核对已绑定资源;对不上的解除绑定、退回池(`reason = no_match`,立即复查),删除该别名和由误并入资源登记的站点别名,各记一条
|
||||
`resolution_attempt(outcome = manual, reason = rollback_wrong_alias)`。内容单元不删,只报告无资源引用的数量;引用了这些资源的其他表只报告。
|
||||
- 2026-09-29 用户库副本演练:《东北有个周东北》29 条绑定里 23 条误并入,删除 7 个站点别名(「电视剧」「动漫」「综艺」与 4 个链式英文名)。
|
||||
|
||||
## 排查
|
||||
|
||||
```sql
|
||||
@@ -86,6 +110,9 @@ select resolution_status, resolution_evidence->>'lookup' as lookup, resolution_e
|
||||
-- 某个合并事项的成员
|
||||
select p.source_release_id, r.title, p.reason from identity_candidate p join source_release r on r.id = p.source_release_id
|
||||
where p.decision_id = '<decisionId>' and p.status = 'pending';
|
||||
-- 站点来源的可疑别名(分类词等)
|
||||
select e.title, a.alias, a.created_at from title_alias a join media_entity e on e.id = a.media_entity_id
|
||||
where a.source = 'site' and a.normalized in ('电视剧', '动漫', '综艺', '电影', '纪录片', '音乐', '短剧');
|
||||
-- 迁移搬走的事项
|
||||
select count(*) from decision where resolution->>'resolution' = 'moved_to_pool';
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user