• Resolved curtisagitate

    (@curtisagitate)


    Hi there,

    I am looking to change the search behaviour of instantsearch to only kick in after 3 characters to reduce API calls / cost.

    This is well documented online, but doesn’t seem to work with the plugin. Adding this JS where instantsearch is instantiated should update behaviour.

    searchFunction: function(helper) {              
    if (helper.state.query.length < 4) {                         
    return; // no search if less than 4 character               
    }               
    helper.search( );     
    }

    This only half works for me, firstly I need to comment out the ‘routing’ code or the search form totally breaks. Secondly while this works for searches done on the search page, it breaks searches done from the default WP search bar which is in the header on all pages.

    https://discourse.algolia.com/t/limit-searches-to-3-characters-or-more-with-instantsearch/8067

    Any thoughts or suggestions / has anyone achieved this?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Limit characters triggering search’ is closed to new replies.