Currently facet items have two states: active and inactive. With expanded hierarchical facets #1250416: Add an option to show hierarchies as expanded, when a 'leaf' item is selected all of its parent items are passed through the active theme function making it appear that they have all been selected.
It seems a third state; 'highlighted' would be useful for those parent items.
It looks like this is totally achievable via a widget plugin and I plan to add it to Collapsible Facets. However I thought I would also bring it up here as it may be useful to add to the built in widgets too.
Also it would be great to hear if you have any thoughts on the matter.
P.S I have tried to search the issue queue a little more thoroughly this time. I don't believe this has been brought up yet, but I apologize if it has. :-P
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | facetapi-1325456-errors.jpg | 176.94 KB | cpliakas |
| #4 | facetapi-1325456-4.patch | 1.61 KB | cpliakas |
Comments
Comment #1
tnightingale commentedLooking into this a little further, it looks like this is not really feasible in a widget plugin as the hierarchical structure (and #active) elements are already defined and set in FacetapiFacetProcessor's processHierarchy() method.
Comment #2
cpliakas commentedThanks for posting.
The one thing I can think of is that both Apache Solr Search Integration and Search API actually index the children along with parents so that the counts are accurate. Otherwise a parent might have a count of 2 whereas a child could have a count of 20. Visually that wouldn't make sense. Therefore from a backend perspective, the parent is essentially selected when you activate it's child. Does this make sense? Let me know if there is a use case that doesn't match this model.
Thanks,
Chris
P.S. I's much rather have duplicate posts than no posts at all, so no worries there!
Comment #3
tnightingale commentedI haven't used Apache Solr Search Integration myself so I don't know how compatible this will be. In our case we're using Search API which doesn't actually enforce indexing of parents with child terms. Instead it is available as an optional "Data Alteration" which is performed at index time.
To help aid my description, lets assume the following simple hierarchy:
I should note that we are using OR facets here. I don't think this applies for AND facets.
Search API (with Facetapi's expanded hierarchies option), allows me to set child1 as 'active' without also setting parent as 'active'. More importantly, it includes a filter in the query for child1 without including a filter for parent.
This does not matter whether you enforce that parent is indexed along with child1 or not.
The issue we face is that Facetapi builds the facet hierarchy with both the parent and the child marked as 'active'.
This wasn't a problem before the expanded hierarchies as you couldn't facet on a child without activating the parent first. Also treating the parent as active is necessary from a ordering perspective; child1's hierarchy needs to float to the top of the list with other active terms. But we need a way of distinguishing (inactive) parent from (active) child1 for display purposes.
So I am proposing a third state which would be a 'highlighted' state. This would be for parent items who have active children, but are not really active themselves.
From an implementation stand point, this state doesn't actually need to be explicit in code, we just need the ability to detect it from within a widget plugin. Here is a rough example patch based on beta7 that my colleague created this afternoon.
Whew! It sure is hard to describe these things clearly. I hope that all somewhat made sense, let me know if you see any glaring holes in the logic.
Comment #4
cpliakas commentedI think I see what you are getting at. Rolling a patch form the link you provided against the latest dev version.
Comment #5
cpliakas commentedMarking as needs work. Applied the patch and got a bunch of notice errors as shown in the attached image.
Comment #6
cpliakas commentedMoving to the 7.x-2.x branch for consideration.