How a search client works
InstantSearch is the UI layer that sits on top of Algolia’s search client layer, with a state managed by the Algolia search helper layer. These three layers are interchangeable so that you can use the InstantSearch widgets with a different search client. The search client queries Algolia’s servers whenever users refines a search. You can build a custom search client to add custom behavior. For example, to perform backend searches with InstantSearch.Implementing a proxy
To prevent the initial empty query, you must wrap a custom search client around Algolia’s, and pass it toais-instant-search.
The custom search client acts as a proxy for search requests:
Vue
search method.
In this case, you only call it when performing a query.
You can also use a proxy to only begin searching after a certain number of characters have been typed by adding a condition, for example,
query.length > 3.Detecting empty search requests
If you don’t want to perform a search request when the query is empty (""),
you need to detect it:
JavaScript
Sometimes, one user action results in multiple queries, for example, clicking on an
ais-refinement-list or using multiple ais-index widgets. Make sure that every query is empty before intercepting the function call.requests array. Each object requires at least these properties: hits, nbHits, and processingTimeMS.
JavaScript
ais-instant-search widget, like this:
Vue