Class: MatchData

lunr.MatchData(term, field, metadata)

new MatchData(term, field, metadata)

Contains and collects metadata about a matching document. A single instance of lunr.MatchData is returned as part of every lunr.Index~Result.

Parameters:
Name Type Description
term string

The term this match data is associated with

field string

The field in which the term was found

metadata object

The metadata recorded about this term in this field

Properties:
Name Type Description
metadata object

A cloned collection of metadata associated with this document.

Source:
See:

Methods

add(term, field, metadata)

Add metadata for a term/field pair to this instance of match data.

Parameters:
Name Type Description
term string

The term this match data is associated with

field string

The field in which the term was found

metadata object

The metadata recorded about this term in this field

Source:

combine(otherMatchData)

An instance of lunr.MatchData will be created for every term that matches a document. However only one instance is required in a lunr.Index~Result. This method combines metadata from another instance of lunr.MatchData with this objects metadata.

Parameters:
Name Type Description
otherMatchData lunr.MatchData

Another instance of match data to merge with this one.

Source:
See: