Configuration options passed to the MiniSearch constructor
The type of documents being indexed.
Function used to extract the value of each field in documents. By default,
the documents are assumed to be plain objects with field names as keys,
but by specifying a custom extractField
function one can completely
customize how the fields are extracted.
The function takes as arguments the document, and the name of the field to extract from it. It should return the field value as a string.
Names of the document fields to be indexed.
Name of the ID field, uniquely identifying a document.
Function used to process a term before indexing or search. This can be used for normalization (such as stemming). By default, terms are downcased, and otherwise no other normalization is performed.
The function takes as arguments a term to process, and the name of the field it comes from. It should return the processed term as a string, or a falsy value to reject the term entirely.
Default search options (see the SearchOptions type and the MiniSearch.search method for details)
Names of fields to store, so that search results would include them. By default none, so resuts would only contain the id field.
Search options to customize the search behavior.
Key-value object of field names to boosting values. By default, fields are assigned a boosting factor of 1. If one assigns to a field a boosting value of 2, a result that matches the query in that field is assigned a score twice as high as a result matching the query in another field, all else being equal.
Function to calculate a boost factor for documents. It takes as arguments the document ID, and a term that matches the search in that document, and should return a boosting factor.
The operand to combine partial results for each term. By default it is "OR", so results matching any of the search terms are returned by a search. If "AND" is given, only results matching all the search terms are returned by a search.
Names of the fields to search in. If omitted, all fields are searched.
Function used to filter search results, for example on the basis of stored fields. It takes as argument each search result and should return a boolean to indicate if the result should be kept or not.
Controls whether to perform fuzzy search. It can be a simple boolean, or a number, or a function.
If a boolean is given, fuzzy search with a default fuzziness parameter is performed if true.
If a number higher or equal to 1 is given, fuzzy search is performed, with a mazimum edit distance (Levenshtein) equal to the number.
If a number between 0 and 1 is given, fuzzy search is performed within a maximum edit distance corresponding to that fraction of the term length, approximated to the nearest integer. For example, 0.2 would mean an edit distance of 20% of the term length, so 1 character in a 5-characters term.
If a function is passed, the function is called upon search with a search term, a positional index of that term in the tokenized search query, and the tokenized search query. It should return a boolean or a number, with the meaning documented above.
Controls whether to perform prefix search. It can be a simple boolean, or a function.
If a boolean is passed, prefix search is performed if true.
If a function is passed, it is called upon search with a search term, the positional index of that search term in the tokenized search query, and the tokenized search query. The function should return a boolean to indicate whether to perform prefix search for that search term.
Function to process or normalize terms in the search query. By default, the same term processor used for indexing is used also for search.
Function to tokenize the search query. By default, the same tokenizer used for indexing is used also for search.
Relative weights to assign to prefix search results and fuzzy search results. Exact matches are assigned a weight of 1.
Type of the search results. Each search result indicates the document ID, the terms that matched, the match information, the score, and all the stored fields.
The type of auto-suggestions
Score for the suggestion
The suggestion
Suggestion as an array of terms
Generated using TypeDoc
Match information for a search result. It is a key-value object where keys are terms that matched, and values are the list of fields that the term was found in.