问题
I want to index orders and corresponding order entries in Solr to display it in our e-commerce site.
I am planning to adopt a De-normalized approach by repeating order details with every order entries to reduce request latency. But at the same time I need to group records by orderid
to find order total for a specified duration.
Is it possible to achieve this without going for a separate index for orders alone?
回答1:
Yes this is possible, you can user Result Grouping / Field Collapsing for your query. In your case the group field should be orderid
and you should add group=true&group.field=orderid
to your request to Solr to enable this feature.
来源:https://stackoverflow.com/questions/33403910/grouping-documents-in-solr