olivernn / lunr.js

A bit like Solr, but much smaller and not as bright
http://lunrjs.com
MIT License
8.87k stars 546 forks source link

Get the actual word in the document from the position #492

Open KulkiratSingh opened 3 years ago

KulkiratSingh commented 3 years ago

Hello,

I have added the position in the metadata using this.metadataWhitelist = ['position']; Now after I get the position of the search word, is it possible to display that same word from the position? For example if there is a string "This is React and jsx together" and then I search for "jsx" after lunr does it's indexing. Then is it possible to get that word printed in the console from it's position?