@lyrasearch/plugin-match-highlight
Version:
Lyrasearch plugin for search match highlighting
14 lines (13 loc) • 789 B
TypeScript
import { Language, Lyra, PropertiesSchema, RetrievedDoc, SearchParams } from '@lyrasearch/lyra';
export interface Position {
start: number;
length: number;
}
export type LyraWithHighlight<S extends PropertiesSchema> = Lyra<S> & {
positions: Record<string, Record<string, Record<string, Position[]>>>;
};
export type SearchResultWithHighlight<S extends PropertiesSchema> = RetrievedDoc<S> & {
positions: Record<string, Record<string, Position[]>>;
};
export declare function afterInsert<S extends PropertiesSchema>(this: Lyra<S> | LyraWithHighlight<S>, id: string): Promise<void>;
export declare function searchWithHighlight<S extends PropertiesSchema>(lyra: LyraWithHighlight<S>, params: SearchParams<S>, language?: Language): Promise<Array<SearchResultWithHighlight<S>>>;