UNPKG

@fast-simon/storefront-kit

Version:

A comprehensive kit for developing storefronts with Fast Simon components, utilities, and React/Hydrogen support.

31 lines (30 loc) 874 B
export interface Options { debug?: string; customScoreFunc?: (lowerQuery: string, lowerKeyword: string) => number; formatKeyword?: (lowerKeyword: string) => string; avoidNumbersTypoCorrection?: boolean; matchAllSubItems?: boolean; } interface Props { keyword: string; query: string; options?: Options; } export declare enum ScoreReason { CUSTOM = "Custom", EXACT_MATCH = "Exact Match", INDEX_OF = "Index Of Query", INDEX_OF_SUB = "Index Of Sub Query", STARTS_WITH = "Start With", TYPO_CORRECTION = "Type Correction", NO_MATCH = "No Match" } export interface SearchResult { score: number; maxScore: number; reason: ScoreReason | string; levenshteinDistance?: number; matchingKeyword: string; } export default function getSearchScore({ keyword, query, options }: Props): SearchResult; export {};