You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by "WU, Zhiqing" <zw...@ennov.com> on 2022/07/29 13:23:40 UTC

numBuckets is not correct.

Hello,
I tried to get numBuckets of a facet but "numBuckets" shown in the Solr
response is wrong.

My query to Solr (8.11):
{
  "query": "caseRef_txt_sort:*009*",
  "limit": 0,
  "fields": ["caseno_s"],
  "facet": {
    "categories": {
      "field": "caseno_s",
      "offset": 0,
      "limit": -1,
      "missing": true,
      "sort": "index asc",
      "type": "terms",
      "numBuckets": true
    }
  }
}

The response from Solr:
{
 "responseHeader": ...
 "facets":{
    "count":117615,
    "categories":{
      "numBuckets":35408,
      "buckets":[{
          "val":"00751940",
          "count":3},
        {
          "val":"00751941",
          "count":3},
          ...
      "missing":{
        "count":0}}}}

After I use several ways to check the size of the "buckets" array, I find
its actual size is 35898 rather than 35408.
Does anybody know what is wrong or how to avoid the issue? Many thanks in
advance.
Kind regards,
Zhiqing