InstantSearch
/
React
/
V6
/
API reference
Jun 25, 2024
SearchState | React InstantSearch V6 (Deprecated)
Deprecated content
This documentation is for a deprecated version of React InstantSearch.
Some features and settings may be missing or their usage may have changed.
Refer to the documentation for the
latest version of React InstantSearch for up-to-date information.
About this widget
The searchState
object is created by React InstantSearch internally. Every widget inside the library has its own way of updating it. To give you a sense of what each widget changes, here’s an example searchState
:
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const searchState = {
range: {
price: {
min: 20,
max: 3000
}
},
configure: {
aroundLatLngViaIP: true,
},
refinementList: {
fruits: ['lemon', 'orange']
},
hierarchicalMenu: {
products: 'Laptops > Surface'
},
menu: {
brands: 'Sony'
},
multiRange: {
rank: '2:5'
},
toggle: {
freeShipping: true
},
hitsPerPage: 10,
sortBy: 'mostPopular',
query: 'ora',
page: 2
}
If you are performing a search on multiple indices using the index-widget
component, you’ll get the following shape:
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const searchState = {
query: 'ora', //shared state between all indices
page: 2, //shared state between all indices
indices: {
index1: {
configure: {
hitsPerPage: 3,
},
},
index2: {
configure: {
hitsPerPage: 10,
},
},
},
}
Did you find this page helpful?