From InstantSearch V1
Yes, it is possible to trigger a search only after a certain number of minimum characters are typed. To do this, you can change the default behaviour by intercepting the search using the helper state.
For example, you can limit the search to only trigger once at least 3 characters were typed:
function customFilters(helper) {
if (helper.state.query.length < 3) {
return; // no search if less than 3 character
}
helper.search();
}
This is an InstantSearch.js example of this functionality: https://codesandbox.io/s/limit-string-length-for-search-nbxbw?file=/src/app.js
This can indeed reduce the number of search operations and reduce the cost. However, we do not recommend this approach as this may cause users to perceive the search to be lagging.
Comments
0 comments
Article is closed for comments.