-
could someone help how to do the sorting https://www.searchkit.co/docs/getting-started/with-react I see at https://www.algolia.com/doc/api-reference/widgets/sort-by/react/#hook-api
I should replace with
but what to use for "Price"??? how to find available indexes (?) ???
no |
Beta Was this translation helpful? Give feedback.
Answered by
srghma
Mar 2, 2024
Replies: 2 comments
-
You're going to have to ask Elastic / Searchkit, not here :) |
Beta Was this translation helpful? Give feedback.
0 replies
-
I actually found in const sk = new Searchkit({
connection: {
host: window.appElasticsearchUrl,
// cloud_id: "my-cloud-id" // if using Elastic Cloud
// if you're authenticating with username/password
// https://www.searchkit.co/docs/guides/setup-elasticsearch#connecting-with-usernamepassword
//auth: {
// username: "elastic",
// password: "changeme"
//},
// if you're authenticating with api key
// https://www.searchkit.co/docs/guides/setup-elasticsearch#connecting-with-api-key
// apiKey: "######"
},
search_settings: {
sorting: {
// default: ...
mysort_price_asc: {field: 'price', order: 'asc'},
mysort_price_desc: {field: 'price', order: 'desc'} },
},
})
<SortBy
items={[
{ label: 'Featured', value: 'products' },
{ label: 'Price (asc)', value: 'mysort_price_asc' },
{ label: 'Price (desc)', value: 'mysort_price_desc' },
]}
/> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
srghma
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I actually found in
searchkit/searchkit#1311