@itwin/core-frontend
Version:
iTwin.js frontend components
45 lines • 1.98 kB
TypeScript
/** @packageDocumentation
* @module Tools
*/
import Fuse from "fuse.js";
/** @public */
export declare class FuzzySearch<T> {
/** Override to provide non-standard FuseOptions for searches where the a single word pattern is used */
onGetSingleWordSearchOptions(): Fuse.FuseOptions<T>;
/** Override to provide non-standard FuseOptions for searches where the a multiple word pattern is used */
onGetMultiWordSearchOptions(): Fuse.FuseOptions<T>;
/** Call to conduct a fuzzy search of searchedObjects, looking at the 'key' member of each such object
* @param searchedObjects An array of objects to search.
* @param keys The name of the members to search in the searchedObjects.
* @param pattern The pattern for which each searchedObject is searched.
* @return FuzzySearchResults.
*/
search(searchedObjects: T[], keys: Array<keyof T>, pattern: string): FuzzySearchResults<T>;
}
/** Interface implemented by objects returned while iterating through FuzzySearchResults
* @public
* @extensions
*/
export interface FuzzySearchResult<T> {
/** Return the current result object */
getResult(): T;
/** Return the key found in this result object */
getMatchedKey(): string;
/** Return the value matched in this result object */
getMatchedValue(): string;
/** Return a boolean array that contains true for each letter in the matched value that was matched part of the search pattern */
getBoldMask(): boolean[];
}
/**
* This class is used to return the results of FuzzySearch.search. It is iterable, with each iteration
* returning an object implementing the FuzzySearchResult interface.
* @public
*/
export declare class FuzzySearchResults<T> implements Iterable<T> {
results: any[];
constructor(results: any[] | undefined);
[Symbol.iterator](): any;
get length(): number;
getResult(resultIndex: number): FuzzySearchResult<T> | undefined;
}
//# sourceMappingURL=FuzzySearch.d.ts.map