Index: contrib/apachesolr_nodeaccess/apachesolr_nodeaccess.module
===================================================================
--- contrib/apachesolr_nodeaccess/apachesolr_nodeaccess.module	(revision 7342)
+++ contrib/apachesolr_nodeaccess/apachesolr_nodeaccess.module	(working copy)
@@ -2,6 +2,65 @@
 // $Id: apachesolr_nodeaccess.module,v 1.1.2.1 2008/11/22 10:28:17 robertDouglass Exp $
 
 /**
+ * Implementation of hook_block().
+ */
+function apachesolr_nodeaccess_block($op = 'list', $delta = 0, $edit = array()) {
+  switch ($op) {
+    case 'list':
+    if (module_exists('og')) {
+      $blocks['group'] = array('info' => t('ApacheSolr Search: Filter by group'));
+    }
+    return $blocks;
+
+    case 'view':
+    if (arg(1) == 'apachesolr_search' && apachesolr_has_searched()) {
+      // Get the query and response. Without these no blocks make sense.
+      $response =& apachesolr_static_response_cache();
+      if (empty($response)) {
+        return;
+      }
+      $query =& apachesolr_drupal_query();
+      // Get information needed by the rest of the blocks about limits.        
+      $facet_display_limits = variable_get('apachesolr_facet_query_limits', array());
+
+      $filter_by = t('Filter by group');
+      return apachesolr_facet_block($response, $query, 'nodeaccess_og_subscriber', $filter_by, 'apachesolr_nodeaccess_get_group');
+    }
+    break;
+
+    case 'configure':
+    if ($delta != 'sort') {
+      return apachesolr_facetcount_form($delta);
+    }
+    break;
+    case 'save':
+    if ($delta != 'sort') {
+      apachesolr_facetcount_save($delta, $edit);
+    }
+    break;
+  }
+}
+
+/**
+ * hook_apachesolr_facets
+ */
+function apachesolr_nodeaccess_apachesolr_facets() {
+  return array('nodeaccess_og_subscriber');
+}
+
+/**
+ * Callback function for the 'Filter by group' facet block.
+ */
+function apachesolr_nodeaccess_get_group($facet) {
+  if ($facet == 0) {
+    return t('No group');
+  }
+
+  $sql = 'SELECT og_description FROM {og} WHERE nid = %d';
+  return db_result(db_query($sql, $facet));
+}
+
+/**
  * Implementation of apachesolr_update_index
  */
 function apachesolr_nodeaccess_apachesolr_update_index(&$document, $node) {
