SOLR - Grouping results with group.limit return wrong numFound

Viewed 5132

When I do a search with grouping result and perform group limit, I get that numFound is the same as I when I don’t use the limit.

It looks like SOLR first performs search and calculates numFound and then limit the results.

I can't use pagination and other stuff. Is there any workaround or I missed something ?


Example:

======================================
| id |  publisher | book_title      |
======================================
| 1  | A1         | Title Book      |
| 2  | A1         | Book title 123  |
| 3  | A1         | My book         |
| 4  | B2         | Hi book title   |
| 5  | B2         | Another Book    |

If I perform query:

q=book_title:book
&group=true 
&group.field=publisher 
&group.limit=1
&group.main=true 

I will get numFound 5 but only 2 in the results.

"response": {
    "numFound": 5,
    "docs": [
        {
            "book_title": "My book",
            "publisher":  "A1"
        },
        {
            "book_title": "Another Book",
            "publisher":  "B2"
        }
    ]
}
5 Answers
Related