diff --git a/core/modules/help/src/Plugin/Search/HelpSearch.php b/core/modules/help/src/Plugin/Search/HelpSearch.php
index 896c0a660855e6aa397eaa7d0839034b332c09fe..e59d67549d9a0d5171b57fb62c964c04cc1b2fa5 100644
--- a/core/modules/help/src/Plugin/Search/HelpSearch.php
+++ b/core/modules/help/src/Plugin/Search/HelpSearch.php
@@ -443,8 +443,8 @@ public function updateTopicList() {
    */
   public function updateIndexState() {
     $query = $this->database->select('help_search_items', 'hsi');
-    $query->addExpression('COUNT(DISTINCT(hsi.sid))');
-    $query->leftJoin('search_dataset', 'sd', 'hsi.sid = sd.sid AND sd.type = :type', [':type' => $this->getType()]);
+    $query->addExpression('COUNT(DISTINCT([hsi].[sid]))');
+    $query->leftJoin('search_dataset', 'sd', '[hsi].[sid] = [sd].[sid] AND [sd].[type] = :type', [':type' => $this->getType()]);
     $query->isNull('sd.sid');
     $never_indexed = $query->execute()->fetchField();
     $this->state->set('help_search_unindexed_count', $never_indexed);