Improved searching logic help
Posted: Tue Apr 09, 2013 2:46 pm
I hope you can help me to speed up my logic for searching in Jade.
We have a set up where:
A Customer has multiple regions they can subscribe to
A Customer has multiple classification they can subscribe to
A Customer has a flag as Active.
We have a product that can be assigned multiple regions and classifications.
Collections
allActiveCustomersByOrg – From Region Class
allActiveCustomersByOrg - From Classification Class
The way we currently search to find a corresponding match between the product and customer is:
Iterate a collection of allActiveCustomersByOrg from the Region Class matching the product regions and then do an includes to see if the customer includes a matching classification.
This is fine for small searches but we are iterating around 5 million customers and 3 million don’t match due to not matching a classification. The results are much the same if we iterate allActiveCustomersByOrg from the Classification Class and do the includes the other way.
What ideas do you have to try to improve the searching?
This is a very simplified version of events but it holds the main point of what I am trying to do.
Thanks
We have a set up where:
A Customer has multiple regions they can subscribe to
A Customer has multiple classification they can subscribe to
A Customer has a flag as Active.
We have a product that can be assigned multiple regions and classifications.
Collections
allActiveCustomersByOrg – From Region Class
allActiveCustomersByOrg - From Classification Class
The way we currently search to find a corresponding match between the product and customer is:
Iterate a collection of allActiveCustomersByOrg from the Region Class matching the product regions and then do an includes to see if the customer includes a matching classification.
This is fine for small searches but we are iterating around 5 million customers and 3 million don’t match due to not matching a classification. The results are much the same if we iterate allActiveCustomersByOrg from the Classification Class and do the includes the other way.
What ideas do you have to try to improve the searching?
This is a very simplified version of events but it holds the main point of what I am trying to do.
Thanks