diff --git a/src/Plugin/search_api/processor/ContentAccess.php b/src/Plugin/search_api/processor/ContentAccess.php
index 18e7f55..a7d66b3 100644
--- a/src/Plugin/search_api/processor/ContentAccess.php
+++ b/src/Plugin/search_api/processor/ContentAccess.php
@@ -174,18 +174,17 @@ class ContentAccess extends ProcessorPluginBase {
       ->filterForPropertyPath($fields, NULL, 'search_api_node_grants');
     foreach ($fields as $field) {
       // Collect grant information for the node.
-      if (!$node->access('view', $anonymous_user)) {
-        // If anonymous user has no permission we collect all grants with
-        // their realms in the item.
-        $sql = 'SELECT * FROM {node_access} WHERE (nid = 0 OR nid = :nid) AND grant_view = 1';
-        $args = [':nid' => $node->id()];
-        foreach ($this->getDatabase()->query($sql, $args) as $grant) {
+      // If there are none, use the pseudo grant 'node_access__all'.
+      $sql = 'SELECT * FROM {node_access} WHERE (nid = 0 OR nid = :nid) AND grant_view = 1';
+      $args = [':nid' => $node->id()];
+      $grant_records = $this->getDatabase()->query($sql, $args)->fetchAll();
+      if (count($grant_records) > 0) {
+        foreach ($grant_records as $grant) {
           $field->addValue("node_access_{$grant->realm}:{$grant->gid}");
         }
       }
       else {
-        // Add the generic pseudo view grant if we are not using node access
-        // or the node is viewable by anonymous users.
+        // Add the generic pseudo view grant if we are not using node access.
         $field->addValue('node_access__all');
       }
     }
diff --git a/tests/src/Kernel/Processor/ContentAccessTest.php b/tests/src/Kernel/Processor/ContentAccessTest.php
index 252fc3c..daf7047 100644
--- a/tests/src/Kernel/Processor/ContentAccessTest.php
+++ b/tests/src/Kernel/Processor/ContentAccessTest.php
@@ -258,8 +258,9 @@ class ContentAccessTest extends ProcessorTestBase {
       $this->processor->addFieldValues($item);
     }
 
+    // Verify it matches our custom grant.
     foreach ($items as $item) {
-      $this->assertEquals(['node_access__all'], $item->getField('node_grants')->getValues());
+      $this->assertEquals(['node_access_search_api_test:0'], $item->getField('node_grants')->getValues());
     }
   }
 
