import { VfsInterface } from "../types";
import MiniSearch, { Options, SearchResult } from 'minisearch';
export declare const validFields: readonly ["path", "basename", "dirname", "extension"];
export type IndexFields = typeof validFields[number][];
export declare const defaultFields: IndexFields;
export declare const defaultFilter: (path: string) => boolean;
export type SearchIndexOptions = Options & {
    filter?: (path: string) => boolean;
};
export type SearchHighlights = {
    fields: Record<string, [number, number][]>;
};
export type HighlightedSearch = SearchResult & {
    highlights: SearchHighlights;
};
export declare class SearchIndex {
    index: MiniSearch;
    constructor(index: MiniSearch);
    search(...params: Parameters<MiniSearch['search']>): HighlightedSearch[];
    /**
     *
     * @param results
     * @returns ranges of found term matched by each field
     */
    highlight(_results: SearchResult[]): SearchHighlights[];
    save(fs: VfsInterface, path: string): Promise<this>;
    static from(fs: string, fields: IndexFields): SearchIndex;
    static get(fs: VfsInterface, path: string, fields?: IndexFields): Promise<SearchIndex>;
    static build(fs: VfsInterface, { filter, ...rest }: SearchIndexOptions): Promise<SearchIndex>;
}
