Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grouped search results views break the range facet display (ArcLight incompatibility) #272

Open
seanaery opened this issue Nov 8, 2024 · 0 comments
Assignees

Comments

@seanaery
Copy link
Collaborator

seanaery commented Nov 8, 2024

Overview

When search results are grouped (a feature essential to ArcLight), the range limit facet will show zero results for the selected range, and fail to render a histogram.
Screenshot 2024-11-07 at 4 24 58 PM

This is a long-standing issue that pre-dates v9.x of blacklight_range_limit; it does not appear that the plugin has ever accounted for grouped search results.

Steps to Reproduce

This would be true of any Blacklight app that uses grouped search results. ArcLight certainly does; TBD which other BL-based applications are impacted.

  • In a new ArcLight app w/blacklight_range_limit added, perform a blank search
  • Enter any date range in the facet; click Apply button
  • Plugin works correctly here (shows correct hits for selected range and displays histogram)
  • Toggle results to Grouped by collection
  • Plugin will show 0 hits for the selected range (and fail to show the histogram)

Why This Matters

The majority of current ArcLight implementations have added the blacklight_range_limit gem and have had to make various local fixes to get it to work correctly. Grouping by collection is essential and the community even supports making that the default view of search results (see projectblacklight/arclight#1488). It would be quite helpful to the community if this plugin would just work out-of-the-box for ArcLight without requiring local modifications.

Some Technical Details

The BlacklightRangeLimit::FacetFieldPresenter currently expects the Solr response for search results to be a Blacklight::Solr::Response and for the total hit count to be in response.total, aka response['numFound'] (see code).

E.g., for a query yielding 510 docs:

{
  "responseHeader": {...},
  "response": {
    "numFound": 510,
    "start": 0,
    "numFoundExact": true,
    "docs": [...]
  },
  "facet_counts": {...},
  "highlighting": {...},
  "stats": {...}
}

But when search results are grouped, the Solr response is a Blacklight::Solr::Response::GroupResponse, which does not use numFound. The total doc count will instead be in ['grouped']['_root_']['matches'], where _root_ is the configured group.field, e.g. :

{
  "responseHeader": {...},
  "grouped": {
    "_root_": {
      "matches": 510,
      "ngroups": 8,
      "groups": [...]
    }
  },
  "facet_counts": {...},
  "highlighting": {...},
  "stats": {...}
}
@seanaery seanaery self-assigned this Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant