FuzzyIndex - All in-memory fuzzy text search lives here.
Two layers:
Low-level: buildFuzzyIndex + fuzzySearchIds / fuzzyHasMatch
operate on a raw string[] corpus and return position indices or a
boolean. Use when the caller already has its own object model.
Typed-corpus: buildItemIndex<T> + searchItems /
searchItemsDetailed keep the original objects alongside the index,
apply optional per-name preprocessing, and prioritize exact matches.
This is what hooks like useTags / useIngredients consume.
Phrase preset: buildPhraseIndex builds an index whose entries
match as whole phrases (single token each). Used by OCR to test
whether a recognized line matches any known nutrition label.
Tuning of fuzzy thresholds and the choice of preprocessing live with
the caller; FuzzyIndex does not know about tags, ingredients, OCR or
any domain concept.
FuzzyIndex - All in-memory fuzzy text search lives here.
Two layers:
Low-level:
buildFuzzyIndex+fuzzySearchIds/fuzzyHasMatchoperate on a rawstring[]corpus and return position indices or a boolean. Use when the caller already has its own object model.Typed-corpus:
buildItemIndex<T>+searchItems/searchItemsDetailedkeep the original objects alongside the index, apply optional per-name preprocessing, and prioritize exact matches. This is what hooks likeuseTags/useIngredientsconsume.Phrase preset:
buildPhraseIndexbuilds an index whose entries match as whole phrases (single token each). Used by OCR to test whether a recognized line matches any known nutrition label.Tuning of fuzzy thresholds and the choice of preprocessing live with the caller; FuzzyIndex does not know about tags, ingredients, OCR or any domain concept.