Optional
autoDefault auto suggest options (see the SearchOptions type and the autoSuggest method for details)
Optional
autoIf true
(the default), vacuuming is performed automatically as soon as
discard is called a certain number of times, cleaning up
obsolete references from the index. If false
, no automatic vacuuming is
performed. Custom settings controlling auto vacuuming thresholds, as well
as batching behavior, can be passed as an object (see the
AutoVacuumOptions type).
Optional
extractFunction 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.
Optional
idName of the ID field, uniquely identifying a document.
Optional
loggerFunction called to log messages. Arguments are a log level ('debug', 'info', 'warn', or 'error'), a log message, and an optional string code that identifies the reason for the log.
The default implementation uses console
, if defined.
Optional
processFunction 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.
It can also return an array of strings, in which case each string in the returned array is indexed as a separate term.
Optional
searchDefault search options (see the SearchOptions type and the search method for details)
Optional
storeNames of fields to store, so that search results would include them. By default none, so results would only contain the id field.
Optional
tokenizeFunction used to split a field value into individual terms to be indexed. The default tokenizer separates terms by space or punctuation, but a custom tokenizer can be provided for custom logic.
The function takes as arguments string to tokenize, and the name of the
field it comes from. It should return the terms as an array of strings.
When used for tokenizing a search query instead of a document field, the
fieldName
is undefined.
Configuration options passed to the SearchIndex constructor