Closed tashburn closed 7 years ago
There are multiple issues asking this very question.
It really depends on how you store the documents that you've indexed in lunr. Lunr does not store the documents for you, it instead builds an index which supports full text search only.
Typically the documents are kept in memory, probably in a hash, and then the reference returned with the search results is used to retrieve the contents of the document from that hash. It really is dependent on your application though, you could be retrieving them from a server using xhr, or pulling them from a client side db like localStorage or IndexedDB, lunr doesn't care.
I see. I had thought that lunr would store the docs internally. Thanks for explaining.
I add a bunch of documents to the index of the form
{id:1, name:'Suzy'}
, whereid
is theref
.Then I search, and get
[{"ref":1, "score":0.217593}]
Now, based on the
ref
of1
, which is theid
, how do I getSuzy
?