Closed LouisRoyT closed 10 months ago
I'd like to suggest integrating with Lunr 2.0 for the search functionality. I believe that by leveraging Lunr 2.0, the search queries can be enhanced and made significantly better. More info here: https://github.com/itemsapi/itemsjs/blob/master/docs/lunr2-integration.md and there is Lunr 2 query interface - https://lunrjs.com/guides/searching.html#scoring
Thanks for the quick response. I will try this approach and get back to you.
When items in the dataset have a (flat)array property, searching through that flat array using "config.searchableFields" only works reliably if the strings are "simple" (no dashes or spaces).
For instance, given the following config & dataset, I believe the expectation would be searching for "bananas", "CL-bananas", "plums" or "oranges" should return the item with id = 1. This is NOT what happens.
searchTerm:"oranges" works fine searchTerm:"CL" matches, but "CL-bananas" does not searchTerm:"purple" matches, but "purple plums", "plums" do not
Codepen reproduction: https://codepen.io/louisroyt/pen/abXvBNo