Closed (fixed)
Project:
Facet API
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
13 May 2011 at 13:51 UTC
Updated:
4 Jan 2014 at 00:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
cpliakas commentedThe issue posted at #830806: Halt date facet drilldown when only one result left is separate, but related.
Comment #2
cpliakas commentedThanks for your post, Patrick.
I understand where you are coming from, but I don't agree. Let's look at the following use case. I have two content types, wiki and blog that share the "Tags" vocabulary. I have three enabled facets, "Content type", "Post date", and "Tags". I narrow down "Content type" and "Post date" so that there is only one tag available.
In the scenario you propose, the "Tags" facet would now be hidden. I think this is valuable information for the user to have. Furthermore, I want to have the option to activate the term so that when I deactivate one of the other facets we are still filtering by that term. What happens if the "Tags" facet is hidden, I deactivate a date or content type, and then the taxonomy term I wanted falls out of view because more terms are now available? Now I have to hunt for it, which is not a good thing.
If you do want this functionality, I would suggest looking at hook_facetapi_facets_alter(). The $build array is the render array for all facets, and you will have all the information you need to manipulate the render array to hide the facets. If you want a more reusable solution, you could also create a widget that extends FacetapiWidgetLinks and overrides FacetapiWidgetLinks::buildListItems() to hide items that won't further refine the result set.
Comment #3
patrick r. commentedHello Chris,
I think I get your point and I agree with it for the described case in which you have already some facets enabled. Seems like my considerations were a bit rash then, maybe friday afternoon at work just isn't the best time to post issues / comments when the approaching weekend is already distracting your thoughts. ;-)
I still think though it would make some sense to hide facets when the initial search produces a single result or a facet just offers one option to choose from, e.g. if all matches for the entered keyword are tagged with the same term or from the same content type.
Comment #4
cpliakas commentedPatrick,
Not rash at all! All ideas are more than welcome, and I am glad you raised this. I definitely do not have all the answers, and the issue queue is a great place to vet this stuff out to make sure what gets added in the module makes the most sense to as many people as possible.
Since this is something you want to do, I want to make sure the module is at least flexible enough to support this. Although I don't see adding the option to the core module, there should be a simple way to provide this functionality that could even be a cool UI contrib project that might contain some other interesting tweaks (want to maintain a small module ;-)). As I have time I will play around with this, but feel free to post your findings to this thread of any shortcomings prevent you from doing it.
Thanks again for the ideas,
Chris
Comment #5
cpliakas commentedP.S. Want to maintain a small module? ;-)
Comment #6
cpliakas commentedRespectfully marking as "works as designed".
Comment #7
cpliakas commentedRe-opening based on the feedback from issue #1216034: The "Current search" block (sometimes) shows IDs instead of labels. Would like to see some patches for this as there seems to be specific use cases that people are trying to achieve.
Comment #8
cpliakas commentedForgot to mark as active...
Comment #9
cpliakas commentedI suck.
Comment #10
drunken monkeySubscribing. I'll probably be too busy, but maybe I'll take a shot at it.
Little brainstorming on which options might be useful for some users:
Basically, if item count equals results count, hide the facet. Otherwise we might get lots of useless facet blocks for small result sets.
Even when they would narrow the results, showing a block with only 1 item might impair the search's Look & Feel. Could also be a configurable "minimum number of items". Not too sure about this, though, as it seems a little far-fetched even to me. It does look weird when it happens for me, but that it happens at all might just be the difference between dummy test data and real-world data.
This was already requested and implemented in the Search API: Basically, the active items are already shown in the "Current search" block (if enabled) – some users might therefore not want to show blocks only with a single active facet, when this doesn't add any additional functionality.
Comment #11
cpliakas commentedThanks for posting your ideas. To me, I see various "facet filters" based on what you are describing. I think adding an API to filter facets by various criteria and adding a couple to core should do the trick. I want to leave some room for people to contribute as well. Maybe even exposing the API and having the implementations live in Search API would be a good idea as well. Anyways, always up for new ideas and different approaches.
Comment #12
cpliakas commentedRelated issue at #1178568: Remove hook_facetapi_facets_alter() and impement another altering method.
Comment #13
cpliakas commentedMarking as duplicate of #1156606: Implement a configurable filter system that can alter the facet's render array prior to being passing to the widget. The filter system will allow for this functionality, and progress will be tracked in that thread.See the list at http://drupal.org/node/1156606#comment-4725960 for what will be supported in core Facet API.Clearly had too many windows open. Posted this to the wrong issue.
Comment #14
cpliakas commentedWebchick says jump, I say "how high?". http://www.webchick.net/node/89
Changing title to reflect what this task has become.
Also, I pushed the filters branch I was working on locally so people can follow my progress on this. Assigning to myself since this a significant API addition.
The following threads have been marked as duplicates of this one:
#830806: Halt date facet drilldown when only one result left
#1178568: Remove hook_facetapi_facets_alter() and impement another altering method
Comment #15
cpliakas commentedHere is my progress so far, just a diff from the "filters" and "7.x-1.x" branch. Marking as needs work because the depth filter is broken and the default system needs to be re-tooled. However, it gives an overview of how the system could work. There is a new "filters" configuration form to apply filters in a certain order. The filter is applied after the results are returned from the server and before the widget plugin is executed, so ultimately it the render to make customizations prior to being passed to the widget.
Comment #16
cpliakas commentedThe system has been committed at 905ade9.
I opened two new issues for some of the suggestions above because they are more complex when taking hierarchical facets into account. I am looking for contributions to get them into the module.
#1234902: Implement filter "Don't show blocks with only 1 (or X) items"
#1234894: Implement filter "Don't show items that won't narrow down the results"
All additional filter plugin requests should be tagged with filter plugin.