lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chantal Ackermann <c.ackerm...@it-agenten.com>
Subject Re: Nested JSON Facets (Subfacets)
Date Thu, 15 Dec 2016 16:01:30 GMT
Hi Yonik,

after upgrading to Solr 6.3.0, the nested function works as expected! (Both with and without
docValues.)

"facets":{
    "count":3179500,
    "all_pop":1.5901646171168616E8,
    "shop_cat":{
      "buckets":[{
          "val":"Kontaktlinsen > Torische Linsen",
          "count":75168,
          "cat_sum":3752665.0497611803},


Thanks,
Chantal


> Am 15.12.2016 um 16:00 schrieb Chantal Ackermann <c.ackermann@it-agenten.com>:
> 
> Hi Yonik,
> 
> are you certain that nesting a function works as documented on http://yonik.com/solr-subfacets/?
> 
> top_authors:{ 
>        type: terms,
>        field: author,
>        limit: 7,
>        sort: "revenue desc",
>        facet:{
>          revenue: "sum(sales)"
>        }
>      }
> 
> 
> I’m getting the feeling that the function is never really executed because, for my
index, calling sum() with a non-number field (e.g. a multi-valued string field) throws an
error when *not nested* but does *not throw an error* when nested:
> 
>    json.facet={all_pop: "sum(gtin)“}
> 
>    "error":{
>        "trace":“java.lang.UnsupportedOperationException
> 	    at org.apache.lucene.queries.function.FunctionValues.doubleVal(FunctionValues.java:47)
> 
> And the following does not throw an error but definitely should if the function would
be executed:
> 
>    json.facet={all_pop:"sum(popularity)",shop_cat: {type:terms, field:shop_cat, facet:
{cat_pop:"sum(gtin)"}}}
> 
> returns:
> 
> "facets":{
>    "count":2815500,
>    "all_pop":1.4065865823321116E8,
>    "shop_cat":{
>      "buckets":[{
>          "val":"Kontaktlinsen > Torische Linsen",
>          "count":75168,
>          "cat_pop":0.0},
>        {
>          "val":"Damen-Mode/Inspirationen",
>          "count":47053,
>          "cat_pop":0.0},
> 
> For completeness: here is the field directive for „gtin“ with „text_noleadzero“
based on „solr.TextField“:
> 
>    <field name="gtin" type="text_noleadzero" indexed="true" stored="true" required="false"
multiValued="true“/>
> 
> 
> Is this a bug or is the documentation a glimpse of the future? I will try version 6.3.0,
now. I was still on 6.1.0 for the above tests.
> (I have also tried with the „avg“ function, just to make sure, but same there.)
> 
> Cheers,
> Chantal


Mime
View raw message