olivernn / lunr.js

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

Perform search by url query parameter #445

Closed inwardmovement closed 4 years ago

inwardmovement commented 4 years ago

Is it possible to perform a search by a url query parameter with Lunr? And to automatically update the url to include the search term as a query parameter?

This would allow to "link to a search".

hoelzro commented 4 years ago

@inwardmovement This is more a matter of the UI than something lunr itself handles. I'm sure this is possible with whatever UI framework you're using, or even just vanilla JavaScript - typically I think you'd update the URL fragment when doing a search, and check the URL fragment upon application load to implement this kind of functionality.

inwardmovement commented 4 years ago

Yes we should be able to do so on the application level you are right — I was just wondering if Lunr could "facilitate" this haha. Thanks for the answer!