SearchSearch Store API functions
Table of Contents
The search endpoint of the Query API searches an indexed collection of data for relevant full-term matches to user-specified search terms. It powers the search feature in your search application.
Pass a value as a string. Alternatively, pass a JSON object to include optional parameters.
Example requests
- Required parameters
window.getSearchStore().search('QUERY')
- Required and optional parameters
window.getSearchStore().search({
query: 'QUERY',
page: PAGE,
limit: LIMIT,
sort: [{
sortField: 'SORT_FIELD',
sortOrder: 'SORT_ORDER'
}],
facets: ['FACET_1', 'FACET_2'],
fieldList: ['FIELD_1', 'FIELD_2'],
highlight: HIGHLIGHT_BOOLEAN,
filters: [{
field: 'FIELD',
values: ['VALUE_1', 'VALUE_2']
}],
analyticsData: true
})
| The preceding example demonstrates the required parameters and some optional parameters to pass with this function. For full details on all parameters and allowed values, see the Query API configuration spec. |
Demo
The following CodePen resource demonstrates the usage of this function. Open your browser’s web console and network monitor logs and watch for activity after clicking the buttons that trigger the Search Store API function.
|
Edit the function and click the corresponding button again to see the result change. |