feat(search): 筛选选项只列结果里有的值,季集合并成一个维度放最前

对照 MP useTorrentFilter:分面选项按实际结果生成,计数为 0 的不再列出(已选的值仍列出,可删除);
新增季集维度 seasonEpisode(MP season_episode 写法 `S01` / `S01-S02` / `S02 E14` / `S01 E25-E48`),
整季在前、单集在后、季号新的在前,在筛选条最前。旧的季 / 集维度保留(旧链接仍生效,以标签列出)。
搜索结果页与站点资源 Tab 共用这套口径。

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-10-06 15:39:32 +08:00
1 parent 18ee466664
commit f6d976a963
7 files changed
+181 -91

No files matched your search

+4 -2
View File
@@ -3,14 +3,14 @@ import { NonNegInt } from "./common.ts";
// 资源列表快速筛选(SEARCH-3):GET /search/releases 与 GET /sites/{id}/releases 共用。
// 口径实现在 @umt/domain release-facets:同一维度多选为 OR,不同维度为 AND;
// 计数按其它维度的已选条件统计(0 = 在其它条件下没有结果)。
// 计数按其它维度的已选条件统计;选项只列计数不为 0 的值(已选的值总会列出)。
export const FacetCount = z.object({ value: z.string(), label: z.string(), count: NonNegInt });
export type FacetCount = z.infer<typeof FacetCount>;
/**
* 快速筛选参数 qf:`维度:值,值;维度:值`,值经 encodeURIComponent。
* 维度:resolution(2160p/1080p/720p/other)、videoCodec(H.265/H.264/AV1/other)、
* 维度:seasonEpisode(季集,MP 写法 `S01` / `S01-S02` / `S02 E14` / `S01 E25-E48`)、resolution(2160p/1080p/720p/other)、videoCodec(H.265/H.264/AV1/other)、
* releaseType(disc/remux/encode/webdl/hdtv/other)、site(站点 ID)、promotion(free/2x/50%/other/none)、
* hdr(DV/HDR10/HDR10+/other/SDR)、hr(yes/no/unknown)、releaseGroup(制作组名,不分大小写)、season(季号)、episode(集号 / pack 整季);
* SEARCH-4 起:audioCodec(Atmos/TrueHD/DTS:X/DTS-HD/DTS/DDP/DD/AAC/FLAC/LPCM/other/unknown)、
@@ -20,6 +20,8 @@ export type FacetCount = z.infer<typeof FacetCount>;
export const QuickFilterParam = z.string().max(4000).optional();
export const ReleaseQuickFacets = z.object({
/** 季集:整季在前、单集在后,季号新的在前(对照 MP);没有剧集资源时为空 */
seasonEpisode: z.array(FacetCount),
resolution: z.array(FacetCount),
videoCodec: z.array(FacetCount),
releaseType: z.array(FacetCount),