Yirmiyahu Fischer
Yirmiyahu Fischer

Reputation: 623

solr query returning doclist of length 1, despite numfound being greater than 1

When querying solr with a group-by field, I a response with "num_found" greater than 1, yet the "docs" attribute only shows 1 record.

The query is something like:

http://.../solr/.../select?q=*%3A*&fq=...&wt=json&indent=true&group=true&group.field=GroupingField_s&group.ngroups=true

The results are something like:

"grouped": {
    "GroupingField_s": {
      "matches": 3130,
      "ngroups": 283,
      "groups": [
        {
          "groupValue": "1111",
          "doclist": {
            "numFound": 7,
            "start": 0,
            "docs": [ {/*only 1 record shown here*/} ]
         },
        {
          "groupValue": "222",
          "doclist": {
            "numFound": 5,
            "start": 0,
            "docs": [ {/*only 1 record shown here*/} ]
        }, ....
     ]
}

Upvotes: 2

Views: 515

Answers (1)

MatsLindh
MatsLindh

Reputation: 52882

You'll have to set the group.limit parameter. This defaults to 1.

group.limit integer Specifies the number of results to return for each group. The default value is 1.

See Result Grouping.

Upvotes: 3

Related Questions