Only required if you're running the DocSearch crawler on your own. It
defines your own application ID using the
appId key. If you're using the free
hosted version, you don't need to consider this parameter.
This method is called when a suggestion is selected (either from a click or a
keystroke). By default, DocSearch displays anchor links to the results page. You
can override results (also called hits) to add your own behavior. Note that you
can already open a new tab thanks to the
CMD/CTRL + Click action.
The method is called with the following arguments:
input: a reference to the search
inputelement. It comes with the
event: the actual event triggering the selection.
suggestion: the object representing the current selection. It contains a
.urlkey representing the destination.
datasetNumber: this should always be equal to
1as DocSearch is searching into one dataset at a time. You can ignore this attribute.
context: additional information about the selection. Contains a
.selectionMethodkey that can be either
blur, depending how the suggestion was selected.
You can try it live on CodeSandbox.
This method is called on every keystroke to transform the typed keywords before querying Algolia. By default, it does not do anything, but we provide this hook for you to add your own logic if needed.
This method will be called on every hits before displaying them. It doesn't do anything by default, but we provide this hook for you to add your own logic and pre-process the hits returned by Algolia.
You can also listen to
autocomplete events through the
property of the
You can forward search parameters to the Algolia API by using the
algoliaOptions key. You will find all Algolia API options in their own
For example, you might want to increase the number of results displayed in the
hitsPerPage set the number of shown hits.