blacklight icon indicating copy to clipboard operation
blacklight copied to clipboard

grouped results pagination show incorrect number of results

Open starsplatter opened this issue 10 years ago • 7 comments

In my catalog controller, I have set up what it looked like I needed to do for result grouping (found mostly by trolling through old posts in the group since the wiki section on grouping is doesn't say much: https://github.com/projectblacklight/blacklight/wiki/Configuration---Results-View )

So here is what I have:

blacklight_config.default_solr_params = 
{ 
 :fq => 
:'group.main'=>'true',
  :group=>'true',
  :'group.field'=>'book_id_ts',
  :'group.format'=>'simple',
  :'group.limit' => 1

}

and

config.index.group = true
config.index.group_field = 'book_id_ts'

This set up returns grouped results but the pagination numbers reflect the ungrouped results. So if there are 17 actual documents but only 12 groups, there will be 12 results but the pagination will state there are 17.

starsplatter avatar Sep 22 '15 16:09 starsplatter

I think this may be a duplicate of #890.

jkeck avatar Sep 23 '15 18:09 jkeck

It's not clear to me how Blacklight can provide the "correct" behavior in this scenario. I think there's an open question whether Blacklight is counting documents or groups (because you could display multiple documents for each group, and provide access to the full list somehow..).

cbeer avatar Sep 23 '15 18:09 cbeer

I agree. It looks to me like blacklight is only seeing the document count and not the group count. My read of the wiki was that blacklight should somehow be able to figure this out by setting the "group" parameter, etc. but I think I was incorrect.

starsplatter avatar Sep 23 '15 19:09 starsplatter

@starsplatter I think we can figure it out if you have group.format=grouped but you set group.format=simple. The format or the response returned by the simple format is so simple that we can't tell it's a grouped response.

jcoyne avatar Sep 23 '15 19:09 jcoyne

It does look like a duplicate of #890 I tried changing group.format to grouped but it doesn't affect the count. The only thing that seems to change the response to include the number of groups is to set :'group.ngroups'=>'true' as mentioned in 890. When I do that, I think I'm getting a response that is different than the structure blacklight might be expecting? The start of the grouped response looks like:

#<Blacklight::SolrResponse::GroupResponse:0x007fa6c2a8ae10 @key="book_id_ts", @group={"matches"=>17, "ngroups"=>12, "groups"=>[{"groupValue"=>"nur00567", "doclist"=>{"numFound"=>3, "start"=>0, "maxScore"=>2.0465183, "docs"=>

... list of docs in group, list of more groups...

@response= <Blacklight::SolrResponse::GroupResponse:0x007fa6c2a8ae10 ...>>]>

starsplatter avatar Sep 23 '15 20:09 starsplatter

@starsplatter please gist the result from solr when you set group.format=grouped. It looks like we're getting closer.

jcoyne avatar Sep 23 '15 20:09 jcoyne

here it is with group.format=grouped and the ngroups also set to true https://gist.github.com/starsplatter/fe89be4fe1df6a3dc07b

starsplatter avatar Sep 23 '15 21:09 starsplatter