Hi guys , I would like to get this example working,
Finall result shoud be having the categories and the hits bellow the autocomplete searchbox.
I also used this doc to add the categories to autocomplete
Now everething is working with the example index.
I can not make it work with my own index , I think that the difficult part is when setting the quierie suggestions.
I already readed the documentation but can not get to a simple working scheme.
Ok ,
The difficult part is:
const querySuggestionsPlugin = createQuerySuggestionsPlugin({
searchClient,
indexName: 'posts_index_query_suggestions',
getSearchParams({ state }) {
return { hitsPerPage: state.query ? 5 : 10 };
},
categoryAttribute: [
/// help me building this!!!
],
itemsWithCategories: 1,
categoriesPerItem: 1,
and this is one of my index example:
{
"title": "Bici",
"country_code": "AR",
"description": "vendo todo",
"tags": [],
"price": 0,
"negotiable": null,
"contact_name": "Leostereo",
"email": "ingrogger@gmail.com",
"phone": "+542612516513",
"phone_hidden": null,
"address": null,
"lon": "-68.83",
"lat": "-32.89",
"visits": "0",
"created_at": "2022-02-03T12:41:22.000000Z",
"created_at_str": "Feb 3, 2022",
"updated_at": "2022-02-03T12:41:22.000000Z",
"slug": "bici",
"url": "http://172.30.200.117/bici/144",
"category": "Tools & Accessories",
"parent_category": "Beauty & Well being",
"city": "Mendoza",
"picture": "http://172.30.200.117/storage/files/ar/144/thumb-120x90-c17e1e2f89cb925ce3af526ada3d80da.jpg",
"objectID": "144"
}
It would be great if you can provide step by step proceadure to set my querie suggestions only for category refinement.
Hope to be clear …
Regards.