For each of these returned matches, I would like to store the original query term that was responsible for the match. For instance, *man was the query token that resulted in a match with spiderman, but from the matchData alone you cannot get this information. Does anybody have a solution for this that doesn't involve post-processing the matchData with (potentially expensive) substring algorithms or rewriting the lunr.Index.prototype.query function?
Suppose that I want I do a search like the following:
const searchResults = index.search('finance *man')
With position token metadata and the default stemmer, the matchData might look like:
For each of these returned matches, I would like to store the original query term that was responsible for the match. For instance,
*man
was the query token that resulted in a match withspiderman
, but from the matchData alone you cannot get this information. Does anybody have a solution for this that doesn't involve post-processing the matchData with (potentially expensive) substring algorithms or rewriting thelunr.Index.prototype.query
function?