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

Don't render the range limit facet on zero results pages; fixes #237. #281

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

seanaery
Copy link
Collaborator

  • reorganize impacted existing specs so they have the data they need to render the range_facet_component

This implements @jrochkind 's idea (and annotation) described in #237 with a minor adjustment to ensure the component's predicate method render? returns a boolean true or false. It adds two new specs verifying that the facet doesn't render, and moves a few existing component specs so they continue to pass.

- reorganize impacted existing specs so they have the data they need to render the range_facet_component
@jrochkind
Copy link
Member

Hmm, while I proposed this solution -- now I'm worried about are there any cases with no min and max where we'd still want to display the form, even though we can't display the chart or facets?

I'm not sure... but maybe we'll still try this, and see how it goes?

@seanaery
Copy link
Collaborator Author

Interesting -- I can't think of any cases where we'd encounter that scenario, but I'm also not 100% certain. The way I think of it is, the facet UI element exists for three purposes: 1) narrow down the current result set, 2) show how many docs in the current result set match the currently selected value(s) for the facet, 3) remove a currently selected value w/X.

If the current result set includes no documents that have a value in the range field, then no matter what values a user would enter into the form, it won't get them any documents, so it seems safe not to render the form.

The facet itself does still render (without the chart & form) in this scenario where there's no min & max:

  • User clicks [Missing] in the facet
  • Result set is only documents that don't have a value in the range field
  • Facet still renders, so user see they have selected [Missing], and can X that selection to remove the filter

@jrochkind
Copy link
Member

I wonder if there's any way to actually check for non-zero results in the search results set.... accessible off that facet_item access that's all we have access to and i'm not sure what class it is!

But I think we can try this and see how it goes!

@jrochkind jrochkind merged commit ca32be1 into main Nov 14, 2024
9 checks passed
@jrochkind jrochkind deleted the 237-suppress-with-zero-results branch November 14, 2024 15:28
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

Successfully merging this pull request may close these issues.

2 participants