Need help to understand which is fastest way to perform search. Or suggestion to any other approach.
Scenario -
Data Type (Things)
1.) Product
2.) Category
Cross Refence -
1.) Product has (field type - List of Categories)
2.) Category has (Field type - List of Products)
If want to display “Product with a particular category”
Approach 1 - Display (Cateorgy1>>List of Product) .
(This may be slow as number of products increase)
Approach 2 - Do a search for Products >>> where Category contains Category1
But as number of categories increase this will become slow. As we search within list of categories.
What is the best approach here. How you guys have solved for this?
Just to give idea (Number of Products will be grow more than 500)
(Number of Categories will grow more than 50)
Avoid approach 1 because a certain category will start piling up a huge list of products not related to each other. Probably just remove the List of Products field under the category all together because it’s going to slow down performance having a huge list tied to a category.
Approach 2 should be very fast and you could also create a bunch of dummy data and test that out. Generally when you do Do a search with constraints it will be extremely fast even for large numbers.
Got it…Just to add… Cross referenced Category field is again list of (data type, Category)
And a single product will have typically 4 to 7 categories. (electronics, TV, Home Appliance etc…)
search take a bit to load (Not much but notable time) I have added loader animation to give good experience.