State can be divided up into a few different types.
- Request State - State that is used as parameters on Search API calls.
- Response State - State that represents a response from a Search API call.
- Application State - The general state.
Request State and Response State will often have similar values. For instance,
searchTerm is the current search term in the UI, and
resultSearchTerm is the term associated with the current
results. This can be relevant in the UI, where you might not want the search term on the page to change until AFTER
a response is received, so you'd use the
State that is used as parameters on Search API calls.
Request state can be set by:
- Using actions, like
- The URL query string, if
Current page number
Array of filters. See Filters section.
Search terms to search for
List of fields and directions to sort on
State that represents a response from a Search API call.
It is not directly update-able.
It is updated indirectly by invoking an action which results in a new API request.
An array of results items fetched for an autocomplete dropdown.
A unique ID for the current autocompleted search results.
A keyed object of query suggestions. It's keyed by type since multiple types of query suggestions can be set here.
A unique ID for the current autocompleted suggestion results.
Will be populated if
facets configured in Search Query Facets Configuration.
The response object received from the API
A unique ID for the current search results.
An array of result items.
As opposed the the
searchTerm state, which is tied to the current search parameter, this is tied to the searchTerm for the current results. There will be a period of time in between when a request is started and finishes where the two pieces of state will differ.
Total number of results found for the current query.
Application state is the general application state.
Error message, if an error was thrown.
Whether or not a search is currently being performed.
Has any query been performed since this driver was created? Can be useful for displaying initial states in the UI.
On this page