Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-7721

When using group.facet=true there are duplicate facets returned

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.10.4
    • Fix Version/s: None
    • Component/s: faceting
    • Labels:
      None
    • Environment:

      JDK 1.8, Linux Ubuntu 14.4 LTS, 16 GB RAM, 2.9 GHZ CPU

      Description

      I have the below schema, and I indexed documents with float fields

      schema.xml
       <field name="SKU" type="string" indexed="true" stored="true" multiValued="false"/>
       <field name="ProductID" type="string" indexed="true" stored="true" multiValued="false"/>
      <field name="NormalizedAverageReview" type="tfloat" default="0.0" indexed="true" stored="false" multiValued="false"/>
      

      Afterwards I add the following documents:

      <doc>
          <field name="SKU">P1SKU00</field>
          <field name="ProductID">P1</field>
          <field name="NormalizedAverageReview">0.0</field>
      </doc>
      <doc>
          <field name="SKU">P1SKU05</field>
          <field name="ProductID">P1</field>
          <field name="NormalizedAverageReview">0.5</field>
      </doc>
      <doc>
          <field name="SKU">P1SKU10</field>
          <field name="ProductID">P1</field>
          <field name="NormalizedAverageReview">1.0</field>
      </doc>
      <doc>
          <field name="SKU">P1SKU15</field>
          <field name="ProductID">P1</field>
          <field name="NormalizedAverageReview">1.5</field>
      </doc>
      <doc>
          <field name="SKU">P1SKU20</field>
          <field name="ProductID">P1</field>
          <field name="NormalizedAverageReview">2.0</field>
      </doc>
      <doc>
          <field name="SKU">P1SKU25</field>
          <field name="ProductID">P1</field>
          <field name="NormalizedAverageReview">2.5</field>
      </doc>
      <doc>
          <field name="SKU">P1SKU30</field>
          <field name="ProductID">P1</field>
          <field name="NormalizedAverageReview">3.0</field>
      </doc>
      <doc>
          <field name="SKU">P1SKU35</field>
          <field name="ProductID">P1</field>
          <field name="NormalizedAverageReview">3.5</field>
      </doc>
      <doc>
          <field name="SKU">P2SKU05</field>
          <field name="ProductID">P2</field>
          <field name="NormalizedAverageReview">0.5</field>
      </doc>
      <doc>
          <field name="SKU">P2SKU15</field>
          <field name="ProductID">P2</field>
          <field name="NormalizedAverageReview">1.5</field>
      </doc>
      <doc>
          <field name="SKU">P2SKU25</field>
          <field name="ProductID">P2</field>
          <field name="NormalizedAverageReview">2.5</field>
      </doc>
      <doc>
          <field name="SKU">P2SKU35</field>
          <field name="ProductID">P2</field>
          <field name="NormalizedAverageReview">3.5</field>
      </doc>
      <doc>
          <field name="SKU">P3SKU00</field>
          <field name="ProductID">P3</field>
          <field name="NormalizedAverageReview">0.0</field>
      </doc>
      <doc>
          <field name="SKU">P3SKU10</field>
          <field name="ProductID">P3</field>
          <field name="NormalizedAverageReview">1.0</field>
      </doc>
      <doc>
          <field name="SKU">P3SKU20</field>
          <field name="ProductID">P3</field>
          <field name="NormalizedAverageReview">2.0</field>
      </doc>
      <doc>
          <field name="SKU">P3SKU30</field>
          <field name="ProductID">P3</field>
          <field name="NormalizedAverageReview">3.0</field>
      </doc>
      <doc>
          <field name="SKU">P4SKU45</field>
          <field name="ProductID">P4</field>
          <field name="NormalizedAverageReview">4.5</field>
      </doc>
      <doc>
          <field name="SKU">P4SKU50</field>
          <field name="ProductID">P4</field>
          <field name="NormalizedAverageReview">5.0</field>
      </doc>
      

      After performing the following query
      http://localhost:8983/solr/collection1/select?q=ProductID:P1&wt=json&indent=true&facet=true&facet.field=NormalizedAverageReview&group=true&group.field=ProductID&group.ngroups=true&group.facet=true&group.limit=-1&indent=true

      There are duplicate facets returned

      Response
      
      {
        "responseHeader":{
          "status":0,
          "QTime":41,
          "params":{
            "q":"ProductID:P1",
            "facet.field":"NormalizedAverageReview",
            "indent":["true",
              "true"],
            "group.limit":"-1",
            "group.facet":"true",
            "group.ngroups":"true",
            "wt":"json",
            "facet":"true",
            "group.field":"ProductID",
            "group":"true"}},
        "grouped":{
          "ProductID":{
            "matches":8,
            "ngroups":1,
            "groups":[{
                "groupValue":"P1",
                "doclist":{"numFound":8,"start":0,"docs":[
                    {
                      "SKU":"P1SKU00",
                      "ProductID":"P1",
                      "_version_":1504885971465797632,
                      "tx_CategoryEnabled":false},
                    {
                      "SKU":"P1SKU05",
                      "ProductID":"P1",
                      "_version_":1504885971547586560,
                      "tx_CategoryEnabled":false},
                    {
                      "SKU":"P1SKU10",
                      "ProductID":"P1",
                      "_version_":1504885971549683712,
                      "tx_CategoryEnabled":false},
                    {
                      "SKU":"P1SKU15",
                      "ProductID":"P1",
                      "_version_":1504885971551780864,
                      "tx_CategoryEnabled":false},
                    {
                      "SKU":"P1SKU20",
                      "ProductID":"P1",
                      "_version_":1504885971552829440,
                      "tx_CategoryEnabled":false},
                    {
                      "SKU":"P1SKU25",
                      "ProductID":"P1",
                      "_version_":1504885971554926592,
                      "tx_CategoryEnabled":false},
                    {
                      "SKU":"P1SKU30",
                      "ProductID":"P1",
                      "_version_":1504885971555975168,
                      "tx_CategoryEnabled":false},
                    {
                      "SKU":"P1SKU35",
                      "ProductID":"P1",
                      "_version_":1504885971557023744,
                      "tx_CategoryEnabled":false}]
                }}]}},
        "facet_counts":{
          "facet_queries":{},
          "facet_fields":{
            "NormalizedAverageReview":[
              "0.0",1,
              "0.5",1,
              "1.0",1,
              "1.5",1,
              "2.0",1,
              "2.5",1,
              "3.0",1,
              "3.5",1,
              "0.0",0,
              "0.5",0,
              "1.0",0,
              "1.5",0,
              "2.0",0,
              "2.5",0,
              "3.0",0,
              "3.5",0,
              "4.5",0,
              "5.0",0,
              "4.5",0]},
          "facet_dates":{},
          "facet_ranges":{},
          "facet_intervals":{}}}
      
      

      If you notice the facet results, there are values repeated in there. For example 4.5 has 2 values (1, 0) as do many of the values. we would expect only 1 entry per value. Seems incorrect that there are duplicates with different values.

      Please advice.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ramzialqrainy Ramzi Alqrainy
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: