Type Definitions
fieldExtractor(doc) → (nullable) {string|object|Array.<object>}
A function that is used to extract a field from a document.
Lunr expects a field to be at the top level of a document, if however the field is deeply nested within a document an extractor function can be used to extract the right field for indexing.
Parameters:
Name | Type | Description |
---|---|---|
doc |
object | The document being added to the index. |
- Source:
Returns:
obj - The object that will be indexed for this field.
- Type
- string | object | Array.<object>
Example
Extracting a nested field
function (doc) { return doc.nested.field }