diff -r ffc64ef81a19 sites/all/modules/contrib/apachesolr/apachesolr_nodeaccess/apachesolr_nodeaccess.module
--- a/sites/all/modules/contrib/apachesolr/apachesolr_nodeaccess/apachesolr_nodeaccess.module	Tue Feb 22 09:48:54 2011 +0100
+++ b/sites/all/modules/contrib/apachesolr/apachesolr_nodeaccess/apachesolr_nodeaccess.module	Wed Feb 23 10:12:01 2011 +0100
@@ -5,25 +5,13 @@
  * Implements apachesolr_update_index
  */
 function apachesolr_nodeaccess_apachesolr_update_index(&$document, $node, $namespace) {
-  static $account;
 
-  if (!isset($account)) {
-    // Load the anonymous user.
-    $account = drupal_anonymous_user();
-  }
-
-  if (!node_access('view', $node, $account)) {
-    // Get node access grants.
-    $result = db_query('SELECT * FROM {node_access} WHERE (nid = 0 OR nid = :nid) AND grant_view = 1', array(':nid' => $node->nid));
-    foreach($result as $grant){
-      $key = 'nodeaccess_' . apachesolr_site_hash() . '_' . $grant->realm;
-      $document->setMultiValue($key, $grant->gid);
-    }
-  }
-  else {
-    // Add the generic view grant if we are not using
-    // node access or the node is viewable by anonymous users.
-    $document->setMultiValue('nodeaccess_all', 0);
+  // Get node access grants.
+  $result = db_query('SELECT * FROM {node_access} WHERE (nid = 0 OR nid = :nid) AND grant_view = 1', array(':nid' => $node->nid));
+  $hash = apachesolr_site_hash();
+  foreach ($result as $grant) {
+    $key = 'nodeaccess_' . $hash . '_' . $grant->realm;
+    $document->setMultiValue($key, $grant->gid);
   }
 }
 
@@ -35,42 +23,53 @@
  * @throws Exception
  */
 function apachesolr_nodeaccess_build_subquery($account) {
+
+  if (user_access('administer nodes', $account)) {
+    return;
+  }
   if (!user_access('access content', $account)) {
-    throw new Exception('No access');
+    return;
   }
-  $node_access_query = apachesolr_drupal_query();
-  if (user_access('bypass node access', $account)) {
-    // Access all content from the current site, or public content.
-    $node_access_query->add_filter('nodeaccess_all', 0);
-    $node_access_query->add_filter('hash', apachesolr_site_hash());
-  }
-  else {
-    // Get node access grants.
-    $grants = node_access_grants('view', $account);
-    foreach ($grants as $realm => $gids) {
+  $subquery = apachesolr_drupal_query();
+  $hash = apachesolr_site_hash();
+
+  // Get node access grants.
+  $grants = node_access_grants('view', $account);
+  foreach ($grants as $realm => $gids) {
+    if ($realm == 'domain_id' || $realm == 'domain_site') {
       foreach ($gids as $gid) {
-        $node_access_query->add_filter('nodeaccess_' . apachesolr_site_hash() . '_' . $realm, $gid);
+        $subquery->add_filter('nodeaccess_' . $hash . '_' . $realm, $gid);
       }
     }
-    $node_access_query->add_filter('nodeaccess_all', 0);
   }
-  return $node_access_query;
+  return $subquery;
 }
 
 /**
  * Implements hook_apachesolr_modify_query().
  */
 function apachesolr_nodeaccess_apachesolr_modify_query(DrupalSolrQueryInterface $query, $caller = 'apachesolr_search') {
+  if (user_access('administer nodes')) {
+    return;
+  }
+  if (!user_access('access content')) {
+    $query = NULL;
+    return;
+  }
+
   global $user;
-  try {
-    $subquery = apachesolr_nodeaccess_build_subquery($user);
-    $query->add_subquery($subquery, 'OR');
+  $subquery = apachesolr_drupal_query();
+  $hash = apachesolr_site_hash();
+  // Get node access grants.
+  $grants = node_access_grants('view', $user);
+  foreach ($grants as $realm => $gids) {
+    if ($realm == 'domain_id' || $realm == 'domain_site') {
+      foreach ($gids as $gid) {
+        $subquery->add_filter('nodeaccess_' . $hash . '_' . $realm, $gid);
+      }
+    }
   }
-  catch (Exception $e) {
-    watchdog("apachesolr_nodeaccess", 'User %name (UID:!uid) cannot search: @message', array('%name' => $user->name, '!uid' => $user->uid, '@message' => $e->getMessage()));
-    // Returning TRUE aborts the search.
-    return TRUE;
-  }
+  $query->add_subquery($subquery);
 }
 
 /**
