blacklight
blacklight copied to clipboard
Facet paginator hides facet missing values
When a facet missing query is executed Solr appends the facet missing value to the facet fields results as an additional value set. This is an extra value count so if normally you are expecting 5 facet field count values you will get 6. The last value will be the facet missing value count represented by [ nil <count>]
, where count is the number of documents that are missing a value for the specified field (i.e. the missing facet).
This is important to note because the way that the current facet Paginator code works is that it grabs a limit of the values determined by the configured facet limit:
# setting limit to nil implies no limit
# @return an array of facets on the page
def items_for_limit(values)
limit.nil? ? values : values.take(limit)
end
Thus if the facet limit is set to 5 and the facet limit count is appended to the end of the returned fact field count list, then Blacklight will not show the facet missing count. In fact there is even a scenario where the facet-missing field is hidden completely. This happens when the last page has facet field counts that is equal to the limit.
The expected result should be that the facet missing count appear. Also it should only appear on the first page as it would be redundant to show it in multiple facet count pages.
Aug 17, 2022 BL Committer Meeting Update:
The limit is required because BL needs a way to determine if there are more facets it get search for. It does this by always asking for x + 1 limit facet values per page but only presenting x values. If x + 1 is returned then the logic in the code and render a "more" pages link.