Skip to content

Change behavior of multiple filters within a single facet#2

Open
brockfanning wants to merge 2 commits into
eikes:masterfrom
brockfanning:single_facet_intersect
Open

Change behavior of multiple filters within a single facet#2
brockfanning wants to merge 2 commits into
eikes:masterfrom
brockfanning:single_facet_intersect

Conversation

@brockfanning

Copy link
Copy Markdown

The current behavior for multiple filters in a single facet is not what I would expect. The result set is a union of the active filters, instead of an intersection. For example in the demo, if I click on "Erlang", I see 9 results as advertised. The "Lisp" filter then advertises that it has only 1 result, since there is only 1 item that is tagged both "Erlang" and "Lisp". So far this is what I would expect. But if I click on "Lisp", the result set now includes 15 items, and the "Lisp" filter count changes to 7.

The behavior I was expecting was 1 item in the result set, and both "Erlang" and "Lisp" counts changing to 1. This is actually the behavior when selecting multiple filters across different facets, so I was thinking that it should probably work the same for multiple filters in a single facet. This is especially important for sites that have only one facet, like a single "tags" taxonomy or something.

My patch changes this behavior. It also removes the code that was changing all zero-counts into plus-signs, since now the "0" actually makes sense. However, the displaying of the empty filters is essentially useless, since clicking on it only reduces the search results to 0. So I've added an option to hide empty filters, and set its default to true.

Thanks for a great script, and hope this is helpful!

…ts that are an intersection of filters, rather than a union. Also add option to hide all empty filters (since they are now useless to display).
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.

1 participant