Hi - Awesome work! As it is, this module is brilliant. I have one request - is there a way I can hide the count for results? I use the taxonomy block facet, and it now displays a count behind each term. Can we remove this at all?

Thanks

CommentFileSizeAuthor
#3 faceted_count_threshold.patch2.3 KBstennie

Comments

David Lesieur’s picture

Glad you like the module! There is currently no setting for hiding the counts, but you may override the theme_faceted_search_ui_category() function in your theme.

David Lesieur’s picture

Status: Active » Closed (works as designed)
stennie’s picture

Version: 6.x-1.x-dev » 5.x-0.21
Status: Closed (works as designed) » Needs review
StatusFileSize
new2.3 KB

We had a similar desire to hide the counts in a flexible fashion.

Patch attached (against current cvs head) to add a faceted_search_count_threshold variable which is the minimum count required for each facet term.

So, if you set this to:
0 => no counts displayed
1 => all counts displayed (since a displayed facet term has at least one match)
# => counts only displayed if greater than this number (eg. 5 => 5 or more matches)

Cheers,
Stephen

David Lesieur’s picture

Interesting... I think having the option of turning the counts off would be a nice feature. However, I wonder what sort of use case would require having counts sometimes displayed, sometimes not, as proposed here. Consistency helps user interface usability. What about making this option a simple checkbox?

stennie’s picture

Hi David,

The use case for counts was at the request of a client who wants more granular control of the UI as they build up their content.

In particular:
- be able to turn off counts completely while there aren't many results
- only show counts when they reach an "interesting" number (like at least 5 or 10)
- eventually, show all counts (except for 1)

It's more of a marketing case, but the strong preference was to avoid a lot of low single digit counts... and the implementation allows that flexibility.

Also as an aside, when we first started using the faceted search the low counts were often inaccurate (but not predictably so). Eventually figured out this was a bug in the taxonomy_facets_node not updating properly for nodes w/ hierarchical taxonomy until the cron ran (#233707). So that probably helped encourage the "don't show low counts if they might be suspect" .. but still seems like a valid UI preference ;-).

Cheers,
Stephen

David Lesieur’s picture

Status: Needs review » Closed (won't fix)

I'm still not convinced that many people would need this. Recognized UI design principles call for predictability and consistency. I think this feature, when enabled, would make the interface less predictable to end users.

Also, if we have count errors, then we should strive to fix them. :-)

Thanks anyway for the patch (code is gold) and keep up the good work!

mdekkers’s picture

That was our reason as well - hide counts for less then desirable numbers - management told us "we dont want customers to see we dont yet have a lot of content on topic xyz, they will think we are not serious about it, etc." I suspect many commercial outfits would feel that way.

Point about UI consistency is very well taken though.

takinola’s picture

Easy hack to remove the node count is as follows

Edit file faceted_search_ui.module
Go to function theme_faceted_search_ui_category()
change the line that reads return '<span class="faceted-search-category">'. $label .'<span class="faceted-search-count">&nbsp;('. $category->get_count() .')</span></span>';

to

return '<span class="faceted-search-category">'. $label .'<span class="faceted-search-count">&nbsp;</span></span>';

of course, you will have to make this change every time you upgrade the module

David Lesieur’s picture

@takinola: Thanks for the clear solution.

Better yet: Add that code to a mytheme_faceted_search_ui_category() function in your theme's template.php. That way you won't have to re-integrate the change each time you upgrade Faceted Search.

Btw, the code can be simplified further:
return '<span class="faceted-search-category">'. $label .'</span>';

BeaPower’s picture

This does work for current version because I can't find it...

BeaPower’s picture

Worked, thanks!

BeaPower’s picture

Worked, nvm had wrong file!

drupalfan81’s picture

Great! Worked. Thanks! I had this hack in their before and then I just upgraded to the new beta3 version and couldn't remember how I got those annoying node count numbers to disappear. I really don't understand why this has yet to be addressed. I think most websites that are just starting out would like this option disabled until they have enough content on their site. Just looks bad from a marketing perspective to have it shown. but love this module, thanks for all that maintain it and keep updating the code. One of my favorite modules!