Hi Yonik,

here is an update on what I’ve tried so far, unfortunately without any more 
luck.

The field directive is (should have included this when asking the question):

   <field name="popularity" type="float" indexed="true" stored="false" 
required="false" multiValued="false" docValues="true“/>

I have also re-indexed (removed data/ and indexed from scratch). The popularity 
field is populated with random values (as I don’t have the real values from 
production) meaning that all documents have values > 0.

Here the statistics output:

 "stats":{
    "stats_fields":{
      "popularity":{
        "min":7.952374289743602E-5,
        "max":99.99993896484375,
        "count":1687500,
        "missing":0,
        "sum":8.436878611434968E7,
        "sumOfSquares":5.626142812197906E9,
        "mean":49.9963176973924,
        "stddev":28.885623872869992},

And this is the relevant facet output from calling

/solr/<core>/query?
json.facet={
num_pop:{query: "popularity[* TO  *]“},
all_pop: "sum(popularity)“,
shop_cat: {type:terms, field:shop_cat, facet: {cat_pop: 
"sum(popularity)"}}}&q=*:*&rows=1&stats.field=popularity&wt=json

"facets":{
    "count":1687500,
    "all_pop":1.5893775613258794E8,
    "num_pop":{
      "count":1687500},
    "shop_cat":{
      "buckets":[{
          "val":"Kontaktlinsen > Torische Linsen",
          "count":75168,
          "cat_pop":0.0},
        {
          "val":"Neu",
          "count":31772,
          "cat_pop":0.0},
        {
          "val":"Gesundheit & Schönheit > Gesundheitspflege",
          "count":20281,
          "cat_pop":0.0},
[… more facets omitted]


The /query handler is an edismax configuration, though I don’t think this 
matters as long as the results include documents with popularity > 0 which is 
the case as seen in the facet output (and sum() works in general for all of the 
documents just not for the buckets as seen in „all_pop").

I will try to explicitly turn off the docValues and add stored=„true“ just to 
try out more. If someone has any other suggestions that I should try - I would 
be glad to here them. If it is not possible to retrieve the sum in this way I 
would have to fetch each sum separately which would be a huge performance 
impact.

Thanks!
Chantal





> Am 15.12.2016 um 10:16 schrieb CA <c...@it-agenten.com>:
> 
>> num_pop:{query:"popularity:[* TO *]"}

Reply via email to