? SolrPhpClient
Index: apachesolr.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.module,v
retrieving revision 1.1.2.12.2.155.2.14
diff -u -p -r1.1.2.12.2.155.2.14 apachesolr.module
--- apachesolr.module	23 Aug 2009 16:38:43 -0000	1.1.2.12.2.155.2.14
+++ apachesolr.module	27 Aug 2009 13:13:45 -0000
@@ -653,6 +653,42 @@ function apachesolr_block($op = 'list', 
 }
 
 /**
+ * This code makes a decision whether to show a block or not.
+ * @param $query
+ *   The current query object.
+ * @param string $module
+ *   The module's name to whom this block belongs.
+ * @param string $delta
+ *   The delta string the identifies the block within $module.
+ * @return boolean
+ *   Whether the block should be visible. Other factors, like
+ *   the block system's visibility settings, apply as well.
+ */
+function apachesolr_block_visibility($query, $module, $delta) {
+  // TYPE HIERARCHY.
+  // If the block is configured to heed type hierarcy then it looks
+  // to see if a suitable type filter has been chosen. If not,
+  // the function returns.
+  $type_filters = variable_get('apachesolr_type_filter', array());
+  if (isset($type_filters['apachesolr_search'][$delta]) && $type_filters['apachesolr_search'][$delta] == TRUE) {
+    $facet_info = module_invoke('apachesolr_search', 'apachesolr_facets');
+    if (isset($facet_info[$delta]['content types'])) {
+      $has_filter = $query->get_filters($facet_info[$delta]['facet_field']);
+      $show = count($has_filter);
+      foreach ($facet_info[$delta]['content types'] as $content_type) {
+        if ($query->has_filter('type', $content_type)) {
+          $show = TRUE;
+        }
+      }
+      if (!$show) {
+        return FALSE;
+      }
+    }
+  }
+  return TRUE;
+}
+
+/**
  * Implementation of hook_form_[form_id]_alter().
  *
  * Hide the core 'title' field in favor of our 'name' field.
Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.6.2.111.2.8
diff -u -p -r1.1.2.6.2.111.2.8 apachesolr_search.module
--- apachesolr_search.module	23 Aug 2009 16:38:43 -0000	1.1.2.6.2.111.2.8
+++ apachesolr_search.module	27 Aug 2009 13:13:45 -0000
@@ -645,25 +645,8 @@ function apachesolr_search_block($op = '
           return;
         }
 
-        // This code makes a decision whether to show this block or not.
-        // If the block is configured to heed type hierarcy then it looks
-        // to see if a suitable type filter has been chosen. If not,
-        // the function returns.
-        $type_filters = variable_get('apachesolr_type_filter', array());
-        if (isset($type_filters['apachesolr_search'][$delta]) && $type_filters['apachesolr_search'][$delta] == TRUE) {
-          $facet_info = module_invoke('apachesolr_search', 'apachesolr_facets');
-          if (isset($facet_info[$delta]['content types'])) {
-            $has_filter = $query->get_filters($facet_info[$delta]['facet_field']);
-            $show = count($has_filter);
-            foreach ($facet_info[$delta]['content types'] as $content_type) {
-              if ($query->has_filter('type', $content_type)) {
-                $show = TRUE;
-              }
-            }
-            if (!$show) {
-              return;
-            }
-          }
+        if (!apachesolr_block_visibility($query, 'apachesolr_search', $delta)) {
+          return;
         }
 
         // Get information needed by the taxonomy blocks about limits.
