blairanderson
3/3/2017 - 11:55 PM

Algolia Search Debounce Example (using debounce with the algolia instant search.)

Algolia Search Debounce Example (using debounce with the algolia instant search.)

queryHook is a hook function that provides the query, and the search callback. You can do your own debouncing or special logic here.

default debounce example:

var timeout = 500;

var queryHook = _.debounce(function(query, search){
  search(query)
},timeout);

search.addWidget(
  instantsearch.widgets.searchBox({
    container: '#q',
    placeholder: 'Search a product',
    queryHook: queryHook
  })
);