Example use for lunr.Index.query()?
See original GitHub issueThe documentation here is helpful:
https://lunrjs.com/docs/lunr.Index.html#query
But I would like to add an example on how to use this method for an example QueryString, for example, *apple* color:red
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Searching - Lunr.js
Although it looks like a string, the search method parses the string into a search query. This supports special syntax for defining more...
Read more >Top 5 lunr Code Examples - Snyk
Learn more about how to use lunr, based on lunr code examples created from the most popular ways it is used in public...
Read more >Adding search to a static site with Lunr and Preact - Aaron Taylor
Add a search query form to every page on the site. ... use in creating the lunr search index. ... Example highlighted search...
Read more >Short Introduction to lunr.py - Calmcode
documents is the list of dictionaries that resemble the documents to be indexed. This gives us an index variable that we can use...
Read more >Static Search With Lunr.js ⋆ Mark McDonnell - integralist
and you want to implement some kind of search facility that is: Free Doesn't Suck ... registerTask("lunr-index", function() { var indexPages ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
AND is not implemented yet, though its definitely on something I want to add. The implementation isn’t so much the problem, rather the query interface, if you have any suggestions on what the API would look like I’d be interested to hear them.
Please open a new issue requesting AND search, I’ll keep this one open just to remind me to improve the documentation around the programatic query API.
As of 2.2.0 term presence is supported by Lunr. The interface isn’t exactly “foo AND bar”, rather the presence of each term can be specified. By default each term is optional, which gives you “foo OR bar”. To get “foo AND bar” would be
+foo +bar
, i.e. documents must contain foo and must contain bar.I’ll update the docs/guides shortly with more examples.