Skip to content

Add reviewed Gutenberg facets domain relevance corpus#38

Merged
ktjn merged 11 commits into
mainfrom
worktree-relevance-domain-facets
Jul 17, 2026
Merged

Add reviewed Gutenberg facets domain relevance corpus#38
ktjn merged 11 commits into
mainfrom
worktree-relevance-domain-facets

Conversation

@ktjn

@ktjn ktjn commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a fourth judged relevance-evaluation domain corpus to packages/relevance: gutenberg-fiction-facets, a snapshot corpus of 30 Project Gutenberg public-domain books (5 real bookshelf genres, years 1764-1929) — the first corpus in this project to exercise real terms-facet (genre) and range-facet (year) filtering under judged relevance.
  • This required genuine engine work, not just fixture authoring: optional facets/rangeFacets/filters schema fields, validator extensions (including filter value-shape validation), and wiring facet-declaring HTML meta tags + query filters through the snapshot-suite runner and evaluator. packages/client/packages/indexer/packages/format are untouched — the facet feature itself was already fully implemented there.
  • Published reviewed baseline at k=5: MRR 1.0, Precision@5 0.36, Recall@5 1.0, nDCG@5 0.960733, zero-result rate 0.0 — see docs/project/relevance-baselines.md. Docs are explicit that facet filtering is covered but facet counts (facetValues()) remain out of scope.
  • Domain B of the relevance-evidence-expansion effort (Domain A, the German domain corpus, shipped in Add reviewed German domain relevance corpus (driving-license law) #37).

Test plan

  • pnpm --filter @ktjn/searchable-relevance test — 165/165 passing
  • npx biome check clean across changed packages/docs
  • Live evaluator run against gutenberg-fiction-facets reproduces the published baseline exactly, including all 7 facet-filtered queries independently verified to respect their declared filters
  • Regression check: all three pre-existing suites (searchable-docs, govuk-learn-to-drive, de-fahrerlaubnisrecht) re-run live and confirmed byte-identical to their recorded baselines — this branch's engine changes are a proven no-op for non-faceted suites
  • Full whole-branch code review completed (ready to merge, no Critical/Important issues)

🤖 Generated with Claude Code

ktjn and others added 11 commits July 17, 2026 19:17
Add new domain suite registration for Gutenberg fiction faceted search:
- Add GUTENBERG_FICTION_FACETS_DOMAIN_QUERY_TOPICS constant with 5 topics
- Spread new topics into DOMAIN_QUERY_TOPICS
- Register "gutenberg-fiction-facets" in KNOWN_DOMAIN_SUITES
- Update test to expect 4 suites and validate ENOENT for missing fixture

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… types

Adds facets/rangeFacets to SnapshotDomainDocument and RelevanceDocument,
and filters to DomainJudgedQuery and JudgedQuery, all optional so
existing suites (searchable-docs, govuk-learn-to-drive,
de-fahrerlaubnisrecht) are unaffected. Types only, no runtime behavior
change yet.
Extend validateDomainSuite to check that snapshot document facets are
non-empty string arrays, rangeFacets are finite numbers, and query
filters only reference facet fields declared somewhere in the corpus.
validateCorpus now returns { documentIds, facetFields } instead of a
bare Set<string> to support cross-document facet-field lookups.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Query filters now must be a non-blank string, a non-empty array of
non-blank strings, or a range filter with finite min/max, instead of
only checking that the filter key names a known facet field.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…apshot evaluator

Emit searchable-facet-<field>/searchable-facet-range-<field> meta tags
for documents declaring facets/rangeFacets in searchable-runner.ts, and
thread query.filters through evaluate.ts's SearchForEvaluation options
and domain-runner.ts's toSnapshotEvaluationSuite, using conditional
spreads so suites without facets/filters produce identical output.
…nts (draft)

Adds packages/relevance/fixtures/domains/gutenberg-fiction-facets.json with
30 real Project Gutenberg public-domain books across 5 genre facets
(Gothic Fiction, Science Fiction, Adventure, Detective Fiction, Children's
Literature) and a year range facet spanning 1764-1929, per Task 1's
source-selection decision note. queries is left empty for Task 7.

Also adds packages/relevance/scripts/hash-gutenberg-facets-content.mjs,
copied from hash-german-domain-content.mjs, used to compute each
document's contentHash.
…ltered queries

Add 20 queries spanning the 5 registered topics (genre-browsing,
publication-era, author-and-title-lookup, plot-and-theme-search,
cross-genre-comparison), 7 of which carry a genre/year/combined filter.
Verified via the project's own analyze() tokenizer that every judged
document's title/description/body genuinely contains the query's terms,
and confirmed by facet/rangeFacet inspection that every filtered query's
positively-judged documents actually satisfy their declared filter.
…fixture exists

Task 2's registration test anticipated the fixture not existing yet;
Tasks 6-7 built it, so the assertion needs to confirm successful load
instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…atting

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…r consistency

Adds a policy test mirroring de-fahrerlaubnisrecht-fixture-policy.test.ts:
document/query counts, topic coverage, content-hash consistency, and
judgment/rationale parity, plus a Gutenberg-specific check that every
filter-bearing query's positively-judged documents genuinely satisfy that
query's genre and/or year-range filter.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…aseline

Flip gutenberg-fiction-facets.json to review.status: reviewed (ktjn,
2026-07-17) and document the reviewed baseline (MRR 1.0, Precision@5 0.36,
Recall@5 1.0, nDCG@5 0.960733, zero-result rate 0.0) in
relevance-baselines.md, called out as the first domain suite to exercise
judged relevance under real terms/range facet filtering. Update roadmap.md
and CHANGELOG.md to reflect the fourth reviewed domain corpus.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ktjn
ktjn merged commit 56e8fda into main Jul 17, 2026
8 checks passed
@ktjn
ktjn deleted the worktree-relevance-domain-facets branch July 17, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant