Merge branch 'search4'
Co-Authored-By: Claude Fable 5.1 <[email protected]> # Conflicts: # docs/plan/00-first-version-plan.md
This commit is contained in:
commit
511ad93077
20 files changed
+773
-94
No files matched your search
@@ -483,6 +483,48 @@ describe.skipIf(!up)("全局搜索", () => {
|
||||
expect([nexusSearches(), mteamSearches()]).toEqual(before);
|
||||
});
|
||||
|
||||
it("SEARCH-4 新维度:音频 / 年份 / 分类 / 做种 / 大小,搜索结果与站点资源列表同一口径", async () => {
|
||||
const q = (qf: string) => req(`/search/releases?q=Dune&qf=${encodeURIComponent(qf)}`).then((r) => r.body.data);
|
||||
const list = (qf: string) =>
|
||||
req(`/sites/${sites.nexus}/releases?q=Dune&live=false&qf=${encodeURIComponent(qf)}`).then((r) => r.body.data);
|
||||
const pick = (f: Loose) =>
|
||||
Object.fromEntries(
|
||||
["audioCodec", "subtitle", "dub", "feature", "year", "category", "size", "seeders"].map((k) => [
|
||||
k,
|
||||
Object.fromEntries(f[k].map((o: Loose) => [o.value, o.count])),
|
||||
]),
|
||||
);
|
||||
const d = await q("");
|
||||
expect(pick(d.facets)).toMatchObject({
|
||||
audioCodec: { Atmos: 1, TrueHD: 1, DDP: 1, AAC: 1 },
|
||||
subtitle: { zh: 1, unknown: 2 },
|
||||
dub: { cmn: 1, en: 1, unknown: 2 },
|
||||
feature: {},
|
||||
year: { "2024": 3 },
|
||||
category: { 电影: 3 },
|
||||
size: { "5-10": 1, "20-50": 1, "50+": 1 },
|
||||
seeders: { "10-49": 1, "50+": 2 },
|
||||
});
|
||||
// 组合:年份 × 做种 × 音频(同维度 OR)
|
||||
const hit = await q("year:2024;seeders:50+;audioCodec:AAC,DDP");
|
||||
expect(hit.items.map((i: Loose) => i.siteReleaseId)).toEqual(["900001"]);
|
||||
expect(hit.facets.audioCodec.find((o: Loose) => o.value === "DDP").count).toBe(0);
|
||||
expect(hit.facets.seeders.find((o: Loose) => o.value === "10-49").count).toBe(1);
|
||||
// 站点资源列表:从资源表的解析结果 / 分类 / 大小 / 做种算,不请求站点
|
||||
const before = nexusSearches();
|
||||
const l = await list("");
|
||||
expect(pick(l.facets)).toMatchObject({
|
||||
audioCodec: { Atmos: 1, TrueHD: 1, AAC: 1 },
|
||||
dub: { cmn: 1, unknown: 1 },
|
||||
category: { 电影: 2 },
|
||||
size: { "5-10": 1, "50+": 1 },
|
||||
seeders: { "50+": 2 },
|
||||
});
|
||||
expect((await list("dub:cmn;category:电影")).total).toBe(1);
|
||||
expect((await list("size:5-10;audioCodec:AAC")).items.map((i: Loose) => i.siteReleaseId)).toEqual(["900001"]);
|
||||
expect(nexusSearches()).toBe(before);
|
||||
});
|
||||
|
||||
it("H&R 筛选:true 只要明确 H&R;false 只排除明确 H&R(unknown 保留)", () => {
|
||||
const base = (id: string, hr: boolean | "unknown") => ({ ...sample, key: id, siteReleaseId: id, hr });
|
||||
const items = [base("a", true), base("b", false), base("c", "unknown")];
|
||||
|
||||
Reference in new issue
Block a user