0
votes

I plan to build something like pricegrabber.com/google product search.

Assume I already have the data available in a huge table. I plan to submit this all to Solr. This solves the problem of search. However I am not sure how to do comparison. I can do a group by query(on UPC/SKU) for the products returned by Solr on the DB. However, I dont want to do that. I want to somehow get product comparison data returned to me along with search from Solr itself.

How do you think should my schema be? Do you think this use-case can be solved all by Solr/Sphinx?

1

1 Answers

1
votes

You need 'result grouping' or 'field collapsing' support to properly handle it.

In Solr, the feature is not available in any release version and is still under development. If you are willing to use an unreleased version of Solr, then get the details here.

Sphinx supports result grouping and I had used it a long time ago in a similar project. You can get more details here.

An alternative strategy could be to preprocess your data so that only a single record per UPC/SKU gets inserted in the index. Each record can have a separate field containing the ids of all the items with the same UPC/SKU.

Doing a database GROUP BY on the products returned by Solr may not be enough. For example, if products A and B have the same UPC and a certain query matches A but not B, then you will not get both A and B in your result set.