? faceted_count_threshold.patch
Index: faceted_search_ui.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/faceted_search/faceted_search_ui.module,v
retrieving revision 1.65
diff -u -p -r1.65 faceted_search_ui.module
--- faceted_search_ui.module	11 Mar 2008 02:09:50 -0000	1.65
+++ faceted_search_ui.module	19 Mar 2008 17:16:05 -0000
@@ -252,6 +252,14 @@ function faceted_search_ui_form_alter($f
       '#default_value' => faceted_search_variable_get($env_id, 'tooltips', FALSE),
     );
 
+    $form['guided']['faceted_search_count_threshold'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Minimum number of results before displaying count on a guided search facet'),
+      '#description' => t('The required number of results before search counts are shown for a facet (0: disable counts, 1: unlimited)'),
+      '#default_value' => variable_get('faceted_search_count_threshold', '1'),
+      '#size' => 3,
+    );
+  
     // Related categories block section.
     $form['related'] = array(
       '#type' => 'fieldset',
@@ -1272,16 +1280,27 @@ function theme_faceted_search_ui_facet_l
  *   category's label is displayed as a search for this category.
  */
 function theme_faceted_search_ui_category($category, $path) {
+  // Note: Tooltips rely on class 'faceted-search-category'.
+  $label = '<span class="faceted-search-category">';
+
   // Note: get_label() is responsible for filtering its returned string.
   if ($path) {
-    $label = l($category->get_label(TRUE), $path, array(), NULL, NULL, NULL, TRUE);
+    $label .= l($category->get_label(TRUE), $path, array(), NULL, NULL, NULL, TRUE);
   }
   else {
-    $label = $category->get_label(TRUE);
+    $label .= $category->get_label(TRUE);
   }
-  
-  // Note: Tooltips rely on class 'faceted-search-category'.
-  return '<span class="faceted-search-category">'. $label .'<span class="faceted-search-count">&nbsp;('. $category->get_count() .')</span></span>';
+ 
+  $threshold = variable_get('faceted_search_count_threshold', 1);
+  $count = $category->get_count();
+
+  if ( $threshold && ($count >= $threshold) ) {
+  	  $label .= "<span class="faceted-search-count">&nbsp;($count)</span>";
+  }
+
+  $label .= '</span>';
+
+  return $label;  
 }
 
 function theme_faceted_search_ui_more($path) {
