I'm using Azure Search on my e-commerce site, and now want to implement filtering.
I've faced issue with performance. I have index with products. Each product belong to category. Each category can have nested subcategories. My business purpose is when customer is on category page i need to show products even from subcategories, so i have doubts about how to store this relation(products to categories) in azure products index. I'm considering two possibilities:
- I can store only products category id in field with type Edm.Int32. Then when customer goes to this category i query to my sql server to get all subcategory ids and then construct my query to index like this
categoryId eq 34 or categoryId eq 36 or categoryId eq 37 ...
- Other way is to create field with type Collection(Edm.String) and to store products category id and nested categories ids in this field and then my query to index would look like this
categoryIds/any(c: c eq '35')
So which way will be faster?