When there is only one search result, the slider simply disappears. It does appear correctly when there is more than one result, and it correctly applies the empty facet behavior when there are no results.

I fixed this with the attached patch because that code only seems to cause this unwanted behavior and doesn't catch other situations. So even with this patch, the empty facet behavior still applies correctly.

Comments

wmostrey’s picture

Status: Needs review » Needs work

This patch needs work. That piece of code also makes the slider disappear when the slider has exactly one value, which is expected behavior. The fact that it also removes the slider when there is exactly one search result is unexpected behavior.

nick_vh’s picture

Can you describe visually what would be expected from a slider when there is only 1 search result? A reset link? Since you do not have a min and max from the search results the 2 buttons will be hovering above eachother making it impossible to move them. We might want to check other websites such as ebay or amazon for examples?

nick_vh’s picture

For example,
http://tweakers.net/pricewatch/cat/50/harde-schijven-intern.html#filter:...

I think behavior like this website is expected from the slider.

Always show the min and max
Always set the bars to the complete range (not from the search results but from the whole index) unless modified by the user

wmostrey’s picture

Tweakers is indeed a good example of the expected behavior. Even when there is only one result or no results at all, the slider is always visible and it always has the min and max value.

(We are now overlapping with #1430774: Empty ranges and empty behavior)

DeFr’s picture

Status: Needs work » Needs review
StatusFileSize
new759 bytes
new5.12 KB

Okay, so, I was working on this, and independently came to pretty much the same conclusion with regard to the expected behavior (which is nice !). The good news is that I also have an implementation, that I'm attaching.

There's still a TODO in the code, for the case where someone manually craft a search url to include a filter that have equals higher and lower bound ; by default, in this case, the handles would overlap. The patch currently hardcodes $slider_min_hande -= 5; $slider_max_handle += 5; in this case, but it's probably not the smartest thing to do (at the very least, the increment should be based on $slider_max_global - $slider_min_global / something).

To be completely usefull, I think this also needs to appear on empty searches, which needs another patch for to the Apache Solr numeric_range query type. I'm attaching it here for you guys to play with and check how it behaves in the empty search case, and I'll open a new issue in the Apache Solr issue queue if we all agree that it sounds like how it should work.

This issue overlaps #1430774: Empty ranges and empty behavior (tweaking the empty search behavior) and #1440612: Ability to force a min/max range (because we're now always forcing the range to the min/max indexed values)

wmostrey’s picture

The patch applies cleanly and works as expected. In my opinion it also takes care of the problems explained in #1430774: Empty ranges and empty behavior and #1440612: Ability to force a min/max range.

primerg’s picture

applied patch 0001-bug-1442934-by-defr-Nick_vh-wmostrey-Change-empty-sl.patch and I haven't experienced any issue with my tests. applying this patch with the second patch works just fine.

I had to manually apply the second patch because I'm still using apachesolr-beta13. both works as described.

ohthehugemanatee’s picture

Patches apply cleanly for me, but I disagree about the expected behavior with regards to min/max range display.

The whole point of facets is that they make it impossible for a (stupid) user to select options that produce an empty result set. If we show the full range available from ALL results, the user can select a nonsensical range. In fact, any use of the slider at all would be nonsensical.

If anything, it should display a ghosted out slider, pointing to the single value available for the one result.

Secondly, the patch does not work as described: it sets the MINIMUM value, but not the MAXIMUM.

Daniel Schaefer’s picture

Issue summary: View changes

Hi,
I very much agree with the posters bevore suggesting the default behaviour is not desirable for user experience. Every time I use this module, my clients complain that they find it confusing that the sliders are disappearing.

I tried applying the patch but it failed ( latest dev-version installed).

Is there a way to let the slider enabled without a code patch?

Thanks

ndobromirov’s picture

Latest dev has already most of the things from #5 patch in it.
I've applied the patch in #5 against the latest dev manually and it worked.
Attaching the patch that worked for me.

Note: It still needs the apachesolr patch in #5 (it applies cleanly).

BR, Nick.