Tioma
Tioma

Reputation: 2150

Lucene/Solr aggregation

I faced with large problem. Lucene can not aggregate data. What alternative solution available.

After some improvement I have and need next :

lucene data example

product_id   distri_id   stock 
1            d1          10
1            d2          20
1            d3          23

I need do query with next condition for example: prod_id =1 and distri_id = (d1 or d2) and stock(sum of d1 and d1) > 13.

So I must aggregate data per dsitri and select where sum of stock more the some value. In other SQL terminology I must do GROUP BY distri HAVING sum(stock)>13.

Can somebody suggest what to do in this case.

Thanks!

Best regards, Artem

Upvotes: 1

Views: 2899

Answers (1)

mindas
mindas

Reputation: 26733

You might want to have a look at field collapsing patch which I guess offers similar functionality.

Also, this says:

<..>introduced Solr’s Result Grouping, also called Field Collapsing, that limits the number of documents shown for each “group”, normally defined as the unique values in a field or function query. <..> You’ll need a recent nightly build of Solr 4.0-dev, or the newly released LucidWorks Enterprise v1.6, our commercial version of Solr.

Upvotes: 2

Related Questions