question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example use for lunr.Index.query()?

See original GitHub issue

The 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:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
olivernncommented, May 14, 2017

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.

0reactions
olivernncommented, Apr 30, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found