itemsapi / itemsjs

Extremely fast faceted search engine in JavaScript - lightweight, flexible, and simple to use
Apache License 2.0
346 stars 41 forks source link

Fuzzy search / prefix match? #131

Closed 684efs3 closed 11 months ago

684efs3 commented 11 months ago

Is there a way to enable fuzzy search or prefix match? I am using MiniSearch, but filter doesn't work with native search turned off. I am trying to filter a range of values. I think it's possible for me to implement this with MiniSearch, but then I thought maybe I don't need MiniSearch. I am using MiniSearch for fuzzy and prefix matching. With ItemsJS, sometimes if I enter the first two letters of a search item, the results will be blank, but then as I type out more letters, the results will show up.

cigolpl commented 11 months ago

ItemsJS by default relies on Lunr version 1, which doesn't have built-in functionality for fuzzy search or prefix match. It's worth noting that the newer Lunr version 2 introduced these functionalities. For more details on searching capabilities with Lunr version 2, you can refer to the official Lunr documentation here: Lunr Searching Guide.

That said, while ItemsJS doesn't natively support these advanced search features, it is designed to be highly adaptable. You can integrate it with other search engines like MiniSearch and even with Lunr version 2.

For steps on how to achieve integration with MiniSearch or Lunr version 2, please check out the following guides in our documentation:

Lunr v2 integration guide MiniSearch integration guide

684efs3 commented 11 months ago

That's really helpful! And thank you very much for creating this library and keeping it updated.

Are there any plans to update ItemsJS to Lunr 2? And is there a way to use the 'filter' option in ItemsJS with MiniSearch or Lunr 2? I get a message saying that ItemsJS's filter ability does not work with native search disabled.

cigolpl commented 11 months ago

Thank you for your feedback! It's appreciated. While it would be great to have built-in Lunr 2 support in ItemsJS, plans for its integration are still undetermined. Currently, the "filter" feature in ItemsJS doesn't work when native search is disabled. We hope for future updates to expand its capabilities.