Solr
  1. Solr
  2. SOLR-2981

multiple stats.facet params duplicate stats faceting output

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.5
    • Fix Version/s: 4.0, 6.0
    • Component/s: None
    • Labels:
      None

      Description

      Response will include two identical "facets" lists for each stats field (ie both "facets" blocks will contain the faceted stats for both of the stats.facet fields)

      1. SOLR-2981.patch
        4 kB
        Hoss Man
      2. SOLR-2981.patch
        0.6 kB
        Roman Kliewer

        Issue Links

          Activity

          Hide
          Hoss Man added a comment -

          Example...

          http://localhost:8983/solr/select?wt=json&indent=true&q=*:*&stats=true&stats.field=price&stats.field=popularity&stats.twopass=true&rows=00&indent=true&stats.facet=inStock&stats.facet=manu_id_s

          {
            "responseHeader":{
              "status":0,
              "QTime":1,
              "params":{
                "indent":["true",
                  "true"],
                "q":"*:*",
                "stats":"true",
                "stats.field":["price",
                  "popularity"],
                "stats.facet":["inStock",
                  "manu_id_s"],
                "wt":"json",
                "stats.twopass":"true",
                "rows":"00"}},
            "response":{"numFound":17,"start":0,"docs":[]
            },
            "stats":{
              "stats_fields":{
                "price":{
                  "min":0.0,
                  "max":2199.0,
                  "count":16,
                  "missing":1,
                  "sum":5251.2699999999995,
                  "sumOfSquares":6038619.160300001,
                  "mean":328.20437499999997,
                  "stddev":536.3536999650977,
                  "facets":{
                    "manu_id_s":{},
                    "inStock":{
                      "false":{
                        "min":11.5,
                        "max":649.99,
                        "count":4,
                        "missing":0,
                        "sum":1161.3899999999999,
                        "sumOfSquares":653369.2551,
                        "mean":290.34749999999997,
                        "stddev":324.6344467628166},
                      "true":{
                        "min":0.0,
                        "max":2199.0,
                        "count":12,
                        "missing":1,
                        "sum":4089.88,
                        "sumOfSquares":5385249.905200001,
                        "mean":340.8233333333333,
                        "stddev":602.368308555086}}},
                  "facets":{
                    "manu_id_s":{},
                    "inStock":{
                      "false":{
                        "min":11.5,
                        "max":649.99,
                        "count":4,
                        "missing":0,
                        "sum":1161.3899999999999,
                        "sumOfSquares":653369.2551,
                        "mean":290.34749999999997,
                        "stddev":324.6344467628166},
                      "true":{
                        "min":0.0,
                        "max":2199.0,
                        "count":12,
                        "missing":1,
                        "sum":4089.88,
                        "sumOfSquares":5385249.905200001,
                        "mean":340.8233333333333,
                        "stddev":602.368308555086}}}},
                "popularity":{
                  "min":0.0,
                  "max":10.0,
                  "count":15,
                  "missing":2,
                  "sum":85.0,
                  "sumOfSquares":603.0,
                  "mean":5.666666666666667,
                  "stddev":2.943920288775949,
                  "facets":{
                    "manu_id_s":{},
                    "inStock":{
                      "false":{
                        "min":1.0,
                        "max":7.0,
                        "count":4,
                        "missing":0,
                        "sum":16.0,
                        "sumOfSquares":100.0,
                        "mean":4.0,
                        "stddev":3.4641016151377544},
                      "true":{
                        "min":0.0,
                        "max":10.0,
                        "count":11,
                        "missing":2,
                        "sum":69.0,
                        "sumOfSquares":503.0,
                        "mean":6.2727272727272725,
                        "stddev":2.6491851234260353}}},
                  "facets":{
                    "manu_id_s":{},
                    "inStock":{
                      "false":{
                        "min":1.0,
                        "max":7.0,
                        "count":4,
                        "missing":0,
                        "sum":16.0,
                        "sumOfSquares":100.0,
                        "mean":4.0,
                        "stddev":3.4641016151377544},
                      "true":{
                        "min":0.0,
                        "max":10.0,
                        "count":11,
                        "missing":2,
                        "sum":69.0,
                        "sumOfSquares":503.0,
                        "mean":6.2727272727272725,
                        "stddev":2.6491851234260353}}}}}}}
          
          Show
          Hoss Man added a comment - Example... http://localhost:8983/solr/select?wt=json&indent=true&q=*:*&stats=true&stats.field=price&stats.field=popularity&stats.twopass=true&rows=00&indent=true&stats.facet=inStock&stats.facet=manu_id_s { "responseHeader" :{ "status" :0, "QTime" :1, "params" :{ "indent" :[ " true " , " true " ], "q" : "*:*" , "stats" : " true " , "stats.field" :[ "price" , "popularity" ], "stats.facet" :[ "inStock" , "manu_id_s" ], "wt" : "json" , "stats.twopass" : " true " , "rows" : "00" }}, "response" :{ "numFound" :17, "start" :0, "docs" :[] }, "stats" :{ "stats_fields" :{ "price" :{ "min" :0.0, "max" :2199.0, "count" :16, "missing" :1, "sum" :5251.2699999999995, "sumOfSquares" :6038619.160300001, "mean" :328.20437499999997, "stddev" :536.3536999650977, "facets" :{ "manu_id_s" :{}, "inStock" :{ " false " :{ "min" :11.5, "max" :649.99, "count" :4, "missing" :0, "sum" :1161.3899999999999, "sumOfSquares" :653369.2551, "mean" :290.34749999999997, "stddev" :324.6344467628166}, " true " :{ "min" :0.0, "max" :2199.0, "count" :12, "missing" :1, "sum" :4089.88, "sumOfSquares" :5385249.905200001, "mean" :340.8233333333333, "stddev" :602.368308555086}}}, "facets" :{ "manu_id_s" :{}, "inStock" :{ " false " :{ "min" :11.5, "max" :649.99, "count" :4, "missing" :0, "sum" :1161.3899999999999, "sumOfSquares" :653369.2551, "mean" :290.34749999999997, "stddev" :324.6344467628166}, " true " :{ "min" :0.0, "max" :2199.0, "count" :12, "missing" :1, "sum" :4089.88, "sumOfSquares" :5385249.905200001, "mean" :340.8233333333333, "stddev" :602.368308555086}}}}, "popularity" :{ "min" :0.0, "max" :10.0, "count" :15, "missing" :2, "sum" :85.0, "sumOfSquares" :603.0, "mean" :5.666666666666667, "stddev" :2.943920288775949, "facets" :{ "manu_id_s" :{}, "inStock" :{ " false " :{ "min" :1.0, "max" :7.0, "count" :4, "missing" :0, "sum" :16.0, "sumOfSquares" :100.0, "mean" :4.0, "stddev" :3.4641016151377544}, " true " :{ "min" :0.0, "max" :10.0, "count" :11, "missing" :2, "sum" :69.0, "sumOfSquares" :503.0, "mean" :6.2727272727272725, "stddev" :2.6491851234260353}}}, "facets" :{ "manu_id_s" :{}, "inStock" :{ " false " :{ "min" :1.0, "max" :7.0, "count" :4, "missing" :0, "sum" :16.0, "sumOfSquares" :100.0, "mean" :4.0, "stddev" :3.4641016151377544}, " true " :{ "min" :0.0, "max" :10.0, "count" :11, "missing" :2, "sum" :69.0, "sumOfSquares" :503.0, "mean" :6.2727272727272725, "stddev" :2.6491851234260353}}}}}}}
          Hide
          Roman Kliewer added a comment -

          Hello, this is my first comment here.

          The bug is caused by the call res.add(FACETS, nl) in StatsValuesFactory in the method getStatsValues()

          The call is now within the facet iteration loop and adds the same object nl multiple times to the res. Just put the call outside of the loop to fix.

          SOLR-2981.patch

          Show
          Roman Kliewer added a comment - Hello, this is my first comment here. The bug is caused by the call res.add(FACETS, nl) in StatsValuesFactory in the method getStatsValues() The call is now within the facet iteration loop and adds the same object nl multiple times to the res . Just put the call outside of the loop to fix. SOLR-2981.patch
          Hide
          Hoss Man added a comment -

          Roman: thanks for tracking this down.

          I've updated your patch to include a test demonstrating the problem.

          Show
          Hoss Man added a comment - Roman: thanks for tracking this down. I've updated your patch to include a test demonstrating the problem.
          Hide
          Hoss Man added a comment -

          Committed revision 1373598. - trunk
          Committed revision 1373605. - 4x

          thanks again Roman!

          Show
          Hoss Man added a comment - Committed revision 1373598. - trunk Committed revision 1373605. - 4x thanks again Roman!
          Hide
          Uwe Schindler added a comment -

          Closed after release.

          Show
          Uwe Schindler added a comment - Closed after release.

            People

            • Assignee:
              Hoss Man
              Reporter:
              Hoss Man
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development