Closed ganeshkbhat closed 6 years ago
I believe the problem is that you have not specified a ref
field, in that case Lunr attempts to retrieve an id
field from your docs, but in your case there is none so ref
is always undefined
.
Seems you want to use the url
field as a reference for the documents, I suggest simply changing this.field('url')
for this.ref('url')
, as described in the "Getting started" guide.
Thank you for your time. this.ref('url')
worked and I was able to get the positions as well using this.metadataWhitelist = ['position'];
. Kudos for the nice simple and flexible library. ;-)
ref : "undefined" in search result for search. Here is my code and example array:
mdArr = [{body:"# Getting started↵↵↵ Texting xxxx text", url:"/assets/mddocs/intro.md"}, {body:"Another body", url:"/assets/mddocs/intro.md"}]
searchString = 'text'
Any help is welcome? Missing something here?