Closed jgerigmeyer closed 6 years ago
I think this is due to passing the wrong arguments to a method here - https://github.com/olivernn/lunr.js/blob/master/lib/index.js#L241
I actually noticed this the other day when working on adding AND query support. My initial thought was that this branch was dead code since the passed arguments looked obviously wrong and there had been no reports of odd behaviour. Looks like I was wrong!
I'll put together a patch to fix this and will get a release out in the next few days, thanks for reporting.
@olivernn I went ahead and submitted a PR to fix this: #321.
Given a multiple-word search token (e.g.
foo bar
), the resultposition
metadata is improperly nested under a key matching the search term (bar
) instead of the index field (e.g.title
).For example, given the following data and search:
The expected result
matchData.metadata
would be:However, the actual result (using Lunr.js v2.1.4) is:
See it live in a jsfiddle: https://jsfiddle.net/jgerigmeyer/3k21gft9/2/