Hi,

I'm using JSON Facet in Solr 5.4.0. Currently, this is what I'm getting in
the JSON output when I'm using the Aggregation Functions.

"facets":{
    "count":9,
    "doDate_dts":{
      "buckets":[{
        {
          "val":"2016-08-29T00:00:00Z",
          "count":3,
          "sum":10.3,
          "avg":3.5},
        {
          "val":"2016-08-30T00:00:00Z",
          "count":0},
        {
          "val":"2016-08-31T00:00:00Z",
          "count":0},
        {
          "val":"2016-09-01T00:00:00Z",
          "count":7,
          "sum":18.9,
          "avg":5.6},
        {
          "val":"2016-09-02T00:00:00Z",
          "count":0},

>From the JSON output, we can see that the Aggregation Functions ("sum" and
"avg") are only shown on the facet which has results. For those Facet with
count are 0, the Aggregation Functions ("sum" and "avg") are not shown.

Is it possible to show the Aggregation Functions ("sum" and "avg") on the
JSON output as well, even when the count is 0? We can just show all 0, like
the following which I have modified manually from the above actual output:

"facets":{
    "count":9,
    "doDate_dts":{
      "buckets":[{
        {
          "val":"2016-08-29T00:00:00Z",
          "count":3,
          "sum":10.3,
          "avg":3.5},
        {
          "val":"2016-08-30T00:00:00Z",
          "count":0,
          "sum":0,
          "avg":0},
        {
          "val":"2016-08-31T00:00:00Z",
          "count":0,
          "sum":0,
          "avg":0},
        {
          "val":"2016-09-01T00:00:00Z",
          "count":7,
          "sum":18.9,
          "avg":5.6},
        {
          "val":"2016-09-02T00:00:00Z",
          "count":0,
          "sum":0,
          "avg":0},

Regards,
Edwin

Reply via email to