Optional
bm25BM25+ algorithm parameters. Customizing these is almost never necessary, and fine-tuning them requires an understanding of the BM25 scoring model. In most cases, it is best to omit this option to use defaults, and instead use boosting to tweak scoring for specific use cases.
Optional
boostKey-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.
Optional
boostFunction 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 the value of the stored fields for the document (if any). It should return a boosting factor: a number higher than 1 increases the computed score, a number lower than 1 decreases the score, and a falsy value skips the search result completely.
Optional
boostFunction to calculate a boost factor for each term.
This function, if provided, is called for each query term (as split by
tokenize
and processed by processTerm
). The arguments passed to the
function are the query term, the positional index of the term in the query,
and the array of all query terms. It is expected to return a numeric boost
factor for the term. A factor lower than 1 reduces the importance of the
term, a factor greater than 1 increases it. A factor of exactly 1 is
neutral, and does not affect the term's importance.
Optional
combineThe 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.
Optional
fieldsNames of the fields to search in. If omitted, all fields are searched.
Optional
filterFunction 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.
Optional
fuzzyControls 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 maximum 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.
The calculated fuzziness value is limited by the maxFuzzy
option, to
prevent slowdown for very long queries.
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.
Optional
maxControls the maximum fuzziness when using a fractional fuzzy value. Very high edit distances usually don't produce meaningful results, but can excessively impact search performance.
Optional
prefixControls 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.
Optional
processFunction to process or normalize terms in the search query. By default, the same term processor used for indexing is used also for search.
Optional
tokenizeFunction to tokenize the search query. By default, the same tokenizer used for indexing is used also for search.
Optional
weightsRelative weights to assign to prefix search results and fuzzy search results. Exact matches are assigned a weight of 1.
The type of id being indexed.