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

Facet buckets count missing after passing {refine:true} | SOLR-7542

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Not A Bug
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Facet Module
    • Labels:
      None

      Description

      I was experimenting / analysing the new Refinement feature in JSON Facet Apis introduced in SOLR-7452. Passing refine:true with the facet definition.

      I am listing down the test-scenarios along with test-data:

      3 sharded collection on 3 nodes
      node/shard: bucketVal - count

      8987: C - 1
      8983: C - 4 D - 1 E - 1 A - 1
      8985: E - 2 A - 1 D - 1

      Total: BUCKETS
      C - 5 E - 3 D - 2 A - 2

      It is giving accurate results for COUNT ASC, LIMIT 1 - 4

      curl http://localhost:8983/solr/collection1/select -d 'q=*:*&json.facet={cat_s:{type:terms,field:cat_s,sort:"count asc",limit:1,overrequest:0,refine:true}}&wt=json&indent=true'
      
        "facets":{
          "count":12,
          "cat_s":{
            "buckets":[{
                "val":"A",
                "count":2}]}}}
      
      curl http://localhost:8983/solr/collection1/select -d 'q=*:*&json.facet={cat_s:{type:terms,field:cat_s,sort:"count asc",limit:2,overrequest:0,refine:true}}&wt=json&indent=true'
      
        "facets":{
          "count":12,
          "cat_s":{
            "buckets":[{
                "val":"A",
                "count":2},
              {
                "val":"D",
                "count":2}]}}}
      

      BUT, COUNT DESC, LIMIT 2 and 3

      curl http://localhost:8983/solr/collection1/select -d 'q=*:*&json.facet={cat_s:{type:terms,field:cat_s,sort:"count desc",limit:2,overrequest:0,refine:true}}&wt=json&indent=true'
      
        "facets":{
          "count":12,
          "cat_s":{
            "buckets":[{
                "val":"C",
                "count":5},
              {
                "val":"A",
                "count":2}]}}}
      
      curl http://localhost:8983/solr/collection1/select -d 'q=*:*&json.facet={cat_s:{type:terms,field:cat_s,sort:"count desc",limit:3,overrequest:0,refine:true}}&wt=json&indent=true'
      
        "facets":{
          "count":12,
          "cat_s":{
            "buckets":[{
                "val":"C",
                "count":5},
              {
                "val":"A",
                "count":2},
              {
                "val":"D",
                "count":2}]}}}
      

      bucketVal E and its count 3 is not in facet response Pardon me if I am missing some configuration or this behavior is right / justified. Ideally we should see bucketVal E and its count 3.

      I am attaching Index DOCS, debugQuery for COUNT DESC, LIMIT 2 and LIMIT 3.

        Attachments

        1. DOCS
          2 kB
          Amrit Sarkar
        2. COUNT_DESC_LIMIT_3
          15 kB
          Amrit Sarkar
        3. COUNT_DESC_LIMIT_2
          15 kB
          Amrit Sarkar

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                sarkaramrit2@gmail.com Amrit Sarkar
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: