Files
PaperClipAI/server/src/__tests__/task-search-query.test.ts
T
DottaandPaperclip 1652a5c7f2 fix: improve task search relevance with a PostgreSQL rubric (#13335)
Unify full and quick task search around PostgreSQL term coverage, explicit relevance bands, and conservative typo recovery. Preserve matching evidence and navigation, and add a judged corpus, regression tests, and documented performance measurements.

Validation: local typecheck, build, focused PostgreSQL tests, and task-list tests pass. All final-head CI gates pass and Greptile is 5/5.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-09-12 16:22:58 -05:00

20 lines
925 B
TypeScript

import { describe, expect, it } from "vitest";
import { parseTaskSearch } from "../services/task-search.js";
describe("task search query intent", () => {
it("keeps negation, short domain terms and quoted filler", () => {
expect(parseTaskSearch('the API is not "in the UI"').tokens).toEqual(["api", "is", "not", "in the ui"]);
expect(parseTaskSearch("the and").tokens).toEqual(["the", "and"]);
});
it("retains the strictest intent for repeated terms", () => {
expect(parseTaskSearch('callback "callback"').terms).toEqual([{ text: "callback", quoted: true }]);
});
it("normalizes task identifiers without guessing their numbers", () => {
for (const q of ["PAP-42", "pap42", "PAP 42"]) expect(parseTaskSearch(q).identifierQuery).toBe("pap-42");
expect(parseTaskSearch("T123-42").identifierQuery).toBe("t123-42");
expect(parseTaskSearch("PAP-420").identifierQuery).toBe("pap-420");
});
});