/** * Shared matching engine for FilterField suggestions. * * Two questions are asked of every suggestion against the current search term: * 1. Does it match? (used for filtering — see `suggestionMatchesTerm`) * 2. How well does it match? (used for sorting — see `getSuggestionMatchPriority`) * * Both questions are answered against the same set of "match targets" (see * `getSuggestionMatchTargets`) and the same text normalization * (see `normalizeSuggestionMatchText`) so filtering and sorting can never drift apart. */ import type { FilterFieldSuggestion } from '../../suggestions/Suggestion.types.js'; export type SuggestionMatchingOptions = { /** * When `false`, the suggestion's `details` text is excluded from matching. * Used at call sites that match suggestions which carry display-only details * (e.g. logical-operator suggestions). * @defaultValue true */ includeDetails?: boolean; }; /** * Canonicalizes text for matching: strips quotes/backslashes and lowercases. * Applied to both the search term and every match target so quoted/escaped * user input compares against the same normalized form as raw suggestion text. * @internal */ export declare function normalizeSuggestionMatchText(value: string): string; /** * Filtering primitive: does any match target contain the normalized term? * @internal */ export declare function suggestionMatchesTerm(suggestion: FilterFieldSuggestion, term: string, options?: SuggestionMatchingOptions): boolean; /** * Sorting primitive: best (lowest) priority across all of the suggestion's * match targets. A suggestion that matches by `value` exactly is ranked above * one that only contains the term in `details`, etc. * * Returns 2 (worst bucket) when no targets exist, so suggestions without * matchable text sort to the end without throwing. * @internal */ export declare function getSuggestionMatchPriority(suggestion: FilterFieldSuggestion, normalizedTerm: string, options?: SuggestionMatchingOptions): number;