UNPKG

ndx

Version:

Lightweight Full-Text Indexing and Searching Library.

38 lines 1.27 kB
import type { DocumentIndex } from "./index.js"; /** * Query Result. * * @typeparam T Document key. */ export interface QueryResult<I> { /** Document key. */ readonly key: I; /** Result score. */ readonly score: number; } /** * Performs a search with a simple free text query. * * All token separators work as a disjunction operator. * * @typeparam T Document key. * @param index {@link DocumentIndex}. * @param fieldBoost Field boost factors. * @param bm25k1 BM25 ranking function constant `k1`, controls non-linear term * frequency normalization (saturation). * @param bm25b BM25 ranking function constant `b`, controls to what degree * document length normalizes tf values. * @param s Query string. * @returns Array of {@link QueryResult} objects. */ export declare const indexQuery: <T>(index: DocumentIndex<T>, fieldBoost: number[], bm25k1: number, bm25b: number, s: string) => QueryResult<T>[]; /** * Expands term with all possible combinations. * * @typeparam I Document ID type. * @param index {@link DocumentIndex} * @param term Term. * @returns All terms that starts with [term] string. */ export declare const expandTerm: <I>(index: DocumentIndex<I>, term: string) => string[]; //# sourceMappingURL=query.d.ts.map