In apachesolr.module, theme_apachesolr_facet_list(), there is a small code issue that sometimes causes the wrong number of visible items in a facet block to appear.
This code:
foreach ($hidden_items as $hidden_item) {
if (!is_array($hidden_item)) {
$hidden_item = array('data' => $hidden_item);
}
$items[] = $hidden_item + array('class' => 'apachesolr-hidden-facet');
}
Should be this:
foreach ($hidden_items as $hidden_item) {
if (!is_array($hidden_item)) {
$hidden_item = array('data' => $hidden_item);
}
$hidden_item['class'] = 'apachesolr-hidden-facet';
$items[] = $hidden_item;
}
The issue is that sometimes $hidden_item already has a class (in my case it was 'collapsible'). Using the '+' operator does not overwrite that value with the appropriate class name, so some of the items that should be hidden initially are not.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 686390-preserve-class-3.patch | 819 bytes | pwolanin |
Comments
Comment #1
pwolanin commentedThe suggested change would overwrite the class you had set - that doesn't sound right either.
Comment #2
justindodge commentedIn my case it seemed to make no difference, but I suppose you're right. For good measure:
Comment #3
pwolanin commentedneed to use isset() to avoid notices
Comment #4
rjbrown99 commentedThere is a second problem with taxonomy facets and number if displayed items. I'm posting it here because the topic is identical but it is a different kind of issue.
In apachesolr_search.module, within the function apachesolr_search_taxonomy_facet_block, towards the bottom, we see this code:
The problem is the $initial_limits variable is never populated. So you end up with the taxonomy blocks ignoring the configured initial filter links value. In my case with a large taxonomy, my block had hundreds of terms displayed when I wanted it to display 10.
The fix is to add this line above the line that starts with $limit:
Comment #5
pwolanin commented@rjbrown - I think this was fixed already in #672882: Broken "Show more" link on taxonomy facets
Comment #6
rjbrown99 commentedYup, didn't see that one. Thanks!
Comment #7
pwolanin commentedIs this patch working for you?
Comment #8
pwolanin commentedcommitted to 6.x-1.x
Comment #9
robertdouglass commented#686390 by pwolanin | rjbrown99: Fixed Wrong number of initial items in taxonomy facet under certain conditions.