Instant search working with even 1 single character

Options

Hi everyone!

We're just starting out implementing projects on Xano (unbelievable how useful it is!).

Right now we are struggling developing an instant search that behaves like google search bar - that is, every character input should make the result array changing instantly.

We are working with Bubble as front end and currently storing 17k data rows in xano.


Any suggestions on how we should proceed?

Tagged:

Answers

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    Hi @Paolo - you will want to trigger the API request on every character entered in the search box. You might consider introducing caching as well if the search results per character will not change too much. This will help you achieve that "instant" feeling.

  • Jack Waterman
    Options

    Happy Holidays! I am adding fuzzy search to my site and would like partial words to count. Do I need to add ":*" to the end of every word to make this work? Guess it's possible with Split and looping through, but I think this would be a popular setting.

    Ex. I'm searching a list of activities. If a record is called "See the symphony at the Kennedy Center", then the search input "Kenn" or "Sym" should include that entry.

    Also, is it possible to return results with any of the words (Word1 OR Word2)?

    Ex. For "See the symphony at the Kennedy Center", the the search input "Orchestra at the Kennedy Center" would return the record. Right now, that does not work.

    Will proceed with what's available for now. Thanks!

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    Hi @Jack Waterman! The way I would look into that problem is to break up the string your user submitted into some useful subsections and run a query looking up each. You'll find that fuzzy search and partial-word search don't totally go together, so doing both might give you better results. These are all decisions you can make in the function stack to make the API endpoint respond in a way that is most helpful to you. Being able to crack open that endpoint to alter its behavior without having to learn NodeJS is a key selling feature of Xano IMHO.

    We work on advanced topics search and getting dirty with the function stack a lot in our State Change Pro office hours held about every business day. A number of Xano customers participate.

  • evanwaller
    Options

    Hey Paolo,

    Before I continue, I will preface that I use Appgyver over Bubble, so my frame of reference is limited; however, I would check to see if bubble has a “Event Triggered when *page variable* changes” feature. Here is how I set mine up on Appgyver:

    1. Set search bar input equal to a new page variable
    2. Every time the search bar variable changes, update the page variable
    3. Then trigger the Xano api to retrieve data

    Let me know if this helps. Reach out with any more questions.

    -Evan