�
Hi Emir,
I can't apply filters to the original query because I don't know in advance 
which filters will meet the criterion I'm looking for.� Unless I'm missing 
something obvious.��
�
I tried the JSON facet you suggested but received

        "response":{"numFound":0,"start":0,"maxScore":0.0,"docs":[]

        � },

        � "facet_counts":{

        � � "facet_queries":{},

        � � "facet_fields":{},

        � � "facet_dates":{},

        � � "facet_ranges":{},

        � � "facet_intervals":{},

        � � "facet_heatmaps":{}},

        � "facets":{

        � � "count":0}}

        �

�


> Hi Chris,

> You mention it returns all manufacturers? Even after you apply filters 
> (don’t see filter in your example)? You can control how many facets are 
> returned with facet.limit and you can use face.pivot.mincount to determine 
> how many facets are returned. If you calculate sum on all
manufacturers, it can last.
>

> Maybe you can try json faceting. Something like (url style):

>

> …&json.facet={sumByManu:{terms:{field:manufacturer,facet:{sum:”sum(price)”}}}}

>

> HTH,

> Emir

> --

> Monitoring - Log Management - Alerting - Anomaly Detection

> Solr & Elasticsearch Consulting Support Training - http://sematext.com/

>

>

>

>> On 12 Nov 2017, at 19:09, ch...@yeeplusplus.com wrote:

>>

>>

>>

>>

>> I have documents in solr that look like this:

>> {

>> "id": "acme-1",

>> "manufacturer": "acme",

>> "product_name": "Foo",

>> "price": 3.4

>> }

>>

>> There are about

>> 150,000 manufacturers, each of which have between 20,000 and 1,000,000 
>> products.

>> I'd like to return the sum of all prices that are in the range [100, 200], 
>> faceted by manufacturer. In other words, for each manufacturer, sum the 
>> prices of all products for that manufacturer,

>> and return the sum and the manufacturer name. For example:

>> [

>> {

>> "manufacturer": "acme",

>> "sum": 150.5

>> },

>> {

>> "manufacturer": "Johnson,

>> Inc.",

>> "sum": 167.0

>> },

>> ...

>> ]

>>

>> I tried this:

>> q=*:*&rows=0&stats=true&stats.field={!tag=piv1 
>> sum=true}price&facet=true&facet.pivot={!stats=piv1}manufacturer

>> which "works" on a test

>> subset of 1,000 manufacturers. However, there are two problems:

>> 1) This query returns all the manufacturers, so I have to iterate over the 
>> entire response object to extract the ones I want.

>> 2) The query on the whole data set takes more than 600 seconds to return, 
>> which doesn't fit

>> our target response time

>>

>> How can I perform this query?

>> We're using solr version 5.5.5.

>>

>>

>>

>> Thanks,

>> Chris

>>

>

>

Reply via email to