lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CA>
Subject Nested JSON Facets (Subfacets)
Date Thu, 15 Dec 2016 09:02:24 GMT
Hi all,

this is about using a function in nested facets, specifically the „sum()“ function inside
a „terms“ facet using the json.facet api.

My json.facet parameter looks like this:

   json.facet={shop_cat: {type:terms, field:shop_cat, facet: {cat_pop:"sum(popularity)"}}}

A snippet of the result:

   "facets“: {
       "shop_cat“: {
           "buckets“: [{
               "val“: "Men > Clothing > Jumpers & Cardigans",
            }, {
              "val":"Men > Clothing > Jackets & Coats",
            }, // and more

This looks fine all over but it turns out that „cat_pop“, the result of „sum(popularity)“
is always 0.0 even if the documents for this facet value have popularities > 0.

A quick check with this json.facet parameter:

   json.facet: {cat_pop:"sum(popularity)“}


   "facets“: {

To me, it seems it works fine on the base level but not when nested. Still, Yonik’s documentation
and the Jira issues indicate that it is possible to use functions in nested facets so I might
just be using the wrong structure? I have a hard time finding any other examples on the i-net
and I had no luck changing the structure around.
Could someone shed some light on this for me? It would also help to know if it is not possible
to sum the values up this way.

Thanks a lot!

View raw message