Here I am using the algolia for the first time to display the categories selected id to pass and load data in list page according to it and here I passed the selected data to the list page but here unable to load the data required for selected category and got crashed in index.search
line please help me how to resolve this ?
Here is my selected categories array data which I was passing from my categories page
["[categories.level0:Men]", "[categories.level1:Men///Tops]", "[categories.level2:Men///Tops///Tees]"]
and below is my facets array data
["categories.level0", "categories.level1", "categories.level2", "gometoo_seller", "style_bottom", "climate", "sleeve", "gender", "category_gear", "eco_collection", "pattern", "collar", "style_bags", "style_general", "is_trending", "erin_recommends", "format", "performance_fabric", "strap_bags", "features_bags", "activity", "material", "categories", "color", "is_new", "size", "price", "manufacturer", "price.BHD.default", "price.EGP.default", "price.EUR.default", "price.KWD.default", "price.OMR.default", "price.SAR.default", "price.USD.default", "price.AED.default"]
here is my algolia back end data
index.search("", {
"hitsPerPage": "10",
"page": "0",
"analytics": "false",
"attributesToRetrieve": "*",
"facets": "[\"categories.level0\",\"categories.level1\",\"categories.level2\",\"activity\",\"category_gear\",\"climate\",\"color\",\"eco_collection\",\"erin_recommends\",\"features_bags\",\"format\",\"gender\",\"gometoo_seller\",\"is_new\",\"is_trending\",\"material\",\"pattern\",\"performance_fabric\",\"price.AED.default\",\"price.BHD.default\",\"price.EGP.default\",\"price.EUR.default\",\"price.KWD.default\",\"price.OMR.default\",\"price.SAR.default\",\"price.USD.default\",\"size\",\"strap_bags\",\"style_bags\",\"style_bottom\",\"style_general\"]",
"facetFilters": "[[\"categories.level2:Men /// Tops /// Tees\"],[\"categories.level1:Men /// Tops\"],[\"categories.level0:Men\"]]"
});
and the code for this is
if (self.appId != nil && self.apiKEY != nil && self.Indices != nil) {
InstantSearch.shared.configure(appID: "\(self.appId!)", apiKey: "\(self.apiKEY!)", index: "\(self.Indices!)en_products")
InstantSearch.shared.params.attributesToRetrieve = ["*"]
InstantSearch.shared.registerAllWidgets(in: self.view)
let query = Query()
query.facets = facetsArray
query.facetFilters = categoriesArray
index.search(query, completionHandler: { (res, error) in
self.listCollectionView.reloadData()
})
hitsCollectionViews = [self.listCollectionView]
ActivityIndicator.stopAnimating()
}