Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b2b5084
Add the pure query core for the analysis catalog
alex-rawlings-yyc Aug 10, 2026
7bf88db
Let the catalog filter on every facet it derives
alex-rawlings-yyc Aug 10, 2026
f15a96b
Let a search match a letter in any positional shape
alex-rawlings-yyc Aug 10, 2026
0d0f501
Document the catalog row cache by what callers can rely on
alex-rawlings-yyc Aug 11, 2026
c1d4d79
Keep a search from matching across two catalog fields
alex-rawlings-yyc Aug 11, 2026
3e5b915
Hold the catalog listing still where a sort key ties
alex-rawlings-yyc Aug 11, 2026
de1730b
Stamp the catalog fixtures so they typecheck again
alex-rawlings-yyc Aug 11, 2026
e051402
Make an untagged analysis a facet choice of its own
alex-rawlings-yyc Aug 11, 2026
e55559d
Name the conditions the catalog docs hold under
alex-rawlings-yyc Aug 11, 2026
220cd09
Sort an analysis with no gloss to the end of the listing
alex-rawlings-yyc Aug 11, 2026
abbdd3a
Document what a catalog row's feature map holds
alex-rawlings-yyc Aug 11, 2026
d8fc717
Make a new catalog sort key fail to compile until it is ordered
alex-rawlings-yyc Aug 11, 2026
9c97eff
Document that the search fold keeps an eszett distinct
alex-rawlings-yyc Aug 11, 2026
9288c6d
Catch a search fold that drops a letter it should keep
alex-rawlings-yyc Aug 11, 2026
753e4fa
Link the identity fold the search fold warns against
alex-rawlings-yyc Aug 11, 2026
4096003
Fold each catalog analysis's search text once
alex-rawlings-yyc Aug 12, 2026
94ff883
Take whitespace at the catalog's edges as no text at all
alex-rawlings-yyc Aug 12, 2026
9defbdf
Read any line break as a space in the catalog's search
alex-rawlings-yyc Aug 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/__tests__/store/analysisSlice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
mergePhrases,
selectApprovedGloss,
selectApprovedMorphemes,
selectCatalogRows,
selectMorphemeResetLosesGlosses,
selectPhraseLinkByTokenRef,
selectPhraseGloss,
Expand Down Expand Up @@ -1855,6 +1856,37 @@ describe('selectPoolIndex', () => {
});
});

describe('selectCatalogRows', () => {
it('returns the same reference for repeated calls on unchanged state (memoized)', () => {
const store = createAnalysisStore();

const a = selectCatalogRows(store.getState().analysis, 'GEN');
const b = selectCatalogRows(store.getState().analysis, 'GEN');

expect(a).toBe(b);
});

it('keeps a book cached across a call for another one', () => {
const store = createAnalysisStore();

const first = selectCatalogRows(store.getState().analysis, 'GEN');
selectCatalogRows(store.getState().analysis, 'MAT');

expect(selectCatalogRows(store.getState().analysis, 'GEN')).toBe(first);
});

it('rebuilds the rows after a gloss write', () => {
const store = createAnalysisStore();
const before = selectCatalogRows(store.getState().analysis, 'GEN');

store.dispatch(writeGloss('GEN 1:1:0', 'λόγος', 'word'));

const after = selectCatalogRows(store.getState().analysis, 'GEN');
expect(after).not.toBe(before);
expect(after.map((row) => row.gloss)).toEqual(['word']);
});
});

describe('selectResolvedTokenAnalysis', () => {
it('returns the approved analysis when the token has one', () => {
const ta: TokenAnalysis = {
Expand Down
8 changes: 8 additions & 0 deletions src/__tests__/utils/analysis-identity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import type { TokenAnalysis } from 'interlinearizer';
import { FIXTURE_STAMPS } from '../test-helpers';
import { analysesAreIdentical, normalizeSurfaceForm } from '../../utils/analysis-identity';
import { foldForSearch } from '../../utils/search-fold';

describe('normalizeSurfaceForm', () => {
it('lowercases so a sentence-initial form matches a mid-sentence form', () => {
Expand All @@ -15,6 +16,13 @@ describe('normalizeSurfaceForm', () => {
expect(decomposed).not.toBe(composed); // distinct raw strings...
expect(normalizeSurfaceForm(decomposed)).toBe(normalizeSurfaceForm(composed)); // ...one key once normalized.
});

// The two normalizations must stay separate: identity under-matches so a recorded distinction is
// never merged away, while the search fold over-matches so a query finds an accented form.
it('keeps a diacritic difference the search fold collapses', () => {
expect(normalizeSurfaceForm('ἀρχῇ')).not.toBe(normalizeSurfaceForm('αρχη'));
expect(foldForSearch('ἀρχῇ')).toBe(foldForSearch('αρχη'));
});
});

/**
Expand Down
Loading
Loading