- domain release-facets: bucket resolution / codec / release type / site / promotion / HDR /
release group / season / episode; OR within a dimension, AND across; disjunctive counts
- GET /search/releases and GET /sites/{id}/releases accept qf and return facets; site list
facets come from local source_release rows only (no site requests), paging stays consistent
- web QuickFilterBar shared by search results and site resources tab: per-dimension popover
(bottom sheet on phones) with counts, removable tags, clear all, localStorage memory per page
- runbook: quick filter params and bucket definitions
Co-Authored-By: Claude Opus 5.5 <[email protected]>
34 lines
1.5 KiB
TypeScript
34 lines
1.5 KiB
TypeScript
import { z } from "zod";
|
|
import { NonNegInt } from "./common.ts";
|
|
|
|
// 资源列表快速筛选(SEARCH-3):GET /search/releases 与 GET /sites/{id}/releases 共用。
|
|
// 口径实现在 @umt/domain release-facets:同一维度多选为 OR,不同维度为 AND;
|
|
// 计数按其它维度的已选条件统计(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)、
|
|
* releaseType(disc/remux/encode/webdl/hdtv/other)、site(站点 ID)、promotion(free/2x/50%/other/none)、
|
|
* hdr(DV/HDR10/HDR10+/other/SDR)、releaseGroup(制作组名,不分大小写)、season(季号)、episode(集号 / pack 整季)。
|
|
*/
|
|
export const QuickFilterParam = z.string().max(4000).optional();
|
|
|
|
export const ReleaseQuickFacets = z.object({
|
|
resolution: z.array(FacetCount),
|
|
videoCodec: z.array(FacetCount),
|
|
releaseType: z.array(FacetCount),
|
|
/** 站点列表(单站)里只有一项 */
|
|
site: z.array(FacetCount),
|
|
promotion: z.array(FacetCount),
|
|
hdr: z.array(FacetCount),
|
|
/** 计数最多的前 20 个 + 已选的 */
|
|
releaseGroup: z.array(FacetCount),
|
|
/** 没有剧集资源时为空 */
|
|
season: z.array(FacetCount),
|
|
episode: z.array(FacetCount),
|
|
});
|
|
export type ReleaseQuickFacets = z.infer<typeof ReleaseQuickFacets>;
|