jeancroy / FuzzySearch

:mag: Fast autocomplete suggestion engine using approximate string matching
MIT License
194 stars 32 forks source link

how do you select the matcing items? #31

Closed halukkaramete closed 2 years ago

halukkaramete commented 2 years ago

Hi, when the algorithm suggests a few items, how do you select one so it is added into the textbox or submit that selection to my server? By default, when I click/choose an item, the text box gets cleared immediately and the suggestions drop-down disappears. I would like it to behave like a typical Google search... In google, when you type, google makes some auto-suggestions, and as soon as you select an item on the suggestions list, you end up firing a Google search for that selection. Is there something like onClick, onSelect type hook, that passes the selection to a js function as inout and from there, I do whatever I can???

jeancroy commented 2 years ago

So in general there's 3 things.

1) Recommendation Engine 2) UI control 3) Integration of the UI control on your website.

This project is (1) there's no UI control (2) included in this project, you have to provide your own.

Most UI controls have exact search recommendation built in. Some UI control allow to plug your own recommendation engine and that's when this library is useful.

After that the UI control should provide you with an event (onchange, onselect or similar) and it's up to you to hook that to an action that submit a form, or do an ajax call etc. This is (3)