diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 57607cd..ab6b030 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -1703,9 +1703,15 @@ function node_search_execute($keys = NULL, $conditions = NULL) {
   $query->join('node', 'n', 'n.nid = i.sid');
   $query
     ->condition('n.status', 1)
-    ->addTag('node_access')
     ->searchExpression($keys, 'node');
 
+  // If node access is restricted, tag the query. Otherwise, when we run
+  // $query->executeFirstPass(), that method will add the node_access JOIN
+  // without regard for this function check.
+  if (!node_access_view_all_nodes()) {
+    $query->addTag('node_access');
+  }
+
   // Insert special keywords.
   $query->setOption('type', 'n.type');
   $query->setOption('language', 'n.language');
