yeraydiazdiaz / lunr.py

A Python implementation of Lunr.js 🌖
http://lunr.readthedocs.io
MIT License
188 stars 16 forks source link

How to search several words? #107

Closed joseberlines closed 2 years ago

joseberlines commented 2 years ago

Can you use lunr to search something like: give me hits in the text of places where the words CAR and ELECTRIC appear with a distance of less than 5 words appart from each other.

Thanks.

yeraydiazdiaz commented 2 years ago

Hi @joseberlines, you can search for both words using term presence:

>>> idx.search('+car +electric')

However, there's no way at the moment to specify the distance in words.

Hope that helps.