feat(facets): closed vocabularies with synonyms, declared on the Resources page #59

Merged
crapougnax merged 1 commit from feat/52-facet-vocabularies into develop 2026-11-19 19:08:47 +00:00
Owner

Refs #52 (step 2 of 3)

Facet vocabularies (src/lib/facets.ts)

  • A facet may declare values: canonical values, given as texts or as { value, synonyms }. Limits: 500 values, 20 synonyms each, 80 characters.
  • Two spellings that differ only by case, accents or spaces are the same; a spelling that stands for two values is refused. An empty list is an open vocabulary.
  • canonicalFacetValue(facet, raw): a synonym gives its value, an unknown value of a closed vocabulary gives undefined; an open facet gives the value trimmed.
  • canonicalFacetValues(source, facets) → { values, rejected }: what ingestion and curation write, and what they show the curator as set aside.
  • facetVocabularies(facets): the closed vocabularies, for writeStudioDocument(document, { vocabularies }).

Resources page

  • New Facettes de classement section: identifier, name, weight, description and vocabulary per facet; add and remove. The vocabulary is typed one value per line, synonyms after a colon (north: northern, N).
  • The page now sends facets with the rest, whole: the facets already declared are loaded into it, so saving keeps them.

Docs: Facets section in docs/DOCUMENT-PROFILE.md (EN, FR), the facets setting in docs/MULTI-TENANCY.md (EN, FR), README.

Not in this PR: calling canonicalFacetValues in the curation route and the ingestion queue (rewritten for tenants in 4a and 4b).

Checks: yarn test 216/216 (10 new). yarn build passes. tsc --noEmit: the same 11 errors as on develop. The page was not tried in a browser.

🤖 Generated with Claude Code

Refs #52 (step 2 of 3) **Facet vocabularies** (`src/lib/facets.ts`) - A facet may declare `values`: canonical values, given as texts or as `{ value, synonyms }`. Limits: 500 values, 20 synonyms each, 80 characters. - Two spellings that differ only by case, accents or spaces are the same; a spelling that stands for two values is refused. An empty list is an open vocabulary. - `canonicalFacetValue(facet, raw)`: a synonym gives its value, an unknown value of a closed vocabulary gives `undefined`; an open facet gives the value trimmed. - `canonicalFacetValues(source, facets)` → `{ values, rejected }`: what ingestion and curation write, and what they show the curator as set aside. - `facetVocabularies(facets)`: the closed vocabularies, for `writeStudioDocument(document, { vocabularies })`. **Resources page** - New *Facettes de classement* section: identifier, name, weight, description and vocabulary per facet; add and remove. The vocabulary is typed one value per line, synonyms after a colon (`north: northern, N`). - The page now sends `facets` with the rest, whole: the facets already declared are loaded into it, so saving keeps them. **Docs**: *Facets* section in `docs/DOCUMENT-PROFILE.md` (EN, FR), the `facets` setting in `docs/MULTI-TENANCY.md` (EN, FR), README. Not in this PR: calling `canonicalFacetValues` in the curation route and the ingestion queue (rewritten for tenants in 4a and 4b). Checks: `yarn test` 216/216 (10 new). `yarn build` passes. `tsc --noEmit`: the same 11 errors as on `develop`. The page was not tried in a browser. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(facets): closed vocabularies with synonyms, declared on the Resources page (#52)
All checks were successful
Build and Publish OCI Image / Build & Push ARM64 OCI Image (pull_request) Successful in 1m8s
97c3795584
A facet may hold a closed vocabulary: canonical values, each with
synonyms. Two spellings that differ only by case or accents are the same,
and a spelling stands for one value only. canonicalFacetValues() brings
values to their canonical form and sets aside those outside the
vocabulary, for ingestion and curation; facetVocabularies() gives the
document profile what to refuse. An empty vocabulary is an open one.

The Resources page of a tenant lists, adds and removes its facets, with
the vocabulary typed one value per line, synonyms after a colon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crapougnax merged commit f627043052 into develop 2026-11-19 19:08:47 +00:00
crapougnax deleted branch feat/52-facet-vocabularies 2026-11-19 19:08:47 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
modaka/studio!59
No description provided.