You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a multiple-word search token (e.g. foo bar), the result position 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:
varidx=lunr(function(){this.ref('name');this.field('text');this.field('title');this.metadataWhitelist=['position'];this.add({"name": "name","title": "foo bar","text": "foo bar buz baz",});});varresult=idx.search('baz foo buz');
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.
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/
The text was updated successfully, but these errors were encountered: