wp-search-with-algolia icon indicating copy to clipboard operation
wp-search-with-algolia copied to clipboard

Consideration: Autocomplete minimum query string length before sending request to Algolia

Open tw2113 opened this issue 9 months ago • 2 comments

https://wordpress.org/support/topic/autocomplete-search-start-only-after-3-characters/

Add a setting for minimum amount of characters to be typed before starting to send to Algolia

At absolute minimum, documentation on how to potentially edit template files for this.

tw2113 avatar Jul 22 '25 19:07 tw2113

Yes please . Also please check with woodmart theme and settings under, tried to add debounce manually there was no way to make it work .

Image

artcila avatar Aug 14 '25 17:08 artcila

Hi @artcila

Just to be certain, debouncing is different than minimum characters before sending.

That said, as is, the debounce details are for just Autocomplete.

That also said, I found this codepen link https://codepen.io/vvo/pen/rMgaGJ that I believe is showing how to add in a debounce for the searchBox widget and most specifically the queryHook property:

queryHook: _.debounce(function(query, search) {
    search(query);
}, 500, {leading: true, trailing: true, maxWait: 200})

Looks like it's utilizing Lodash for the _.debounce() function.

Docs on this parameter: https://www.algolia.com/doc/api-reference/widgets/search-box/js/#widget-param-queryhook

tw2113 avatar Aug 14 '25 18:08 tw2113