itemsapi / itemsjs

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

Allow "like" search query #37

Closed regisphilibert closed 3 years ago

regisphilibert commented 5 years ago

Currently using this list of items:

I have looked #28 but could not find the proper "token" for what I am looking for.

I wonder if there is a configuration setting allowing the like searchers. I've tried wrapping the query value between * à la Lurnr.js but I think those are escaped by ItemsJS.

Thanks.

cigolpl commented 5 years ago

The idea seems useful. Is the like feature '*' supported by lunr.js ?

regisphilibert commented 5 years ago

There is a notion of wildcards if this can help: https://lunrjs.com/guides/searching.html

cigolpl commented 5 years ago

Thanks. We'll need to upgrade Lunr.js from 1.0 to the newest 2.x soon. Fortunately API seems almost the same https://lunrjs.com/guides/upgrading.html so upgrading should not be a problem.

Additional features will be available by default then i.e. wildcard, boosting or searching by field

One change which I see will be:

The behaviour of the search has changed slightly, multi-term searches are now combined with OR, where they used to be combined with AND.

Practically this change means that a given search will return more documents in 2.x than it did previously, with the most relevant results returned first.

Not sure yet if this change will be good or not

cigolpl commented 3 years ago

@regisphilibert you can use Lunr 2.x (or plenty of others) by custom integration. Example is here https://github.com/itemsapi/itemsjs/blob/master/docs/lunr2-integration.md. Thanks to that you have full control over search features (wildcards, etc)