diff --git a/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php
index aea6f93..ce1da74 100644
--- a/core/modules/node/src/Plugin/Search/NodeSearch.php
+++ b/core/modules/node/src/Plugin/Search/NodeSearch.php
@@ -208,8 +208,8 @@ protected function findResults() {
     // Build matching conditions.
     $query = $this->database
       ->select('search_index', 'i', array('target' => 'replica'))
-      ->extend('Drupal\search\SearchQuery')
-      ->extend('Drupal\Core\Database\Query\PagerSelectExtender');
+      ->extend('Drupal\Core\Database\Query\PagerSelectExtender')
+      ->extend('Drupal\search\SearchQuery');
     $query->join('node_field_data', 'n', 'n.nid = i.sid');
     $query->condition('n.status', 1)
       ->addTag('node_access')
diff --git a/core/modules/search/src/SearchQuery.php b/core/modules/search/src/SearchQuery.php
index de679c2..6b399a6 100644
--- a/core/modules/search/src/SearchQuery.php
+++ b/core/modules/search/src/SearchQuery.php
@@ -606,7 +606,8 @@ public function countQuery() {
     if (count($this->conditions)) {
       $inner->condition($this->conditions);
     }
-    // PostgreSQL requires a group by condition to prevent a GROUPING ERROR.
+    // Custom plugins mostly adds more joins on search_dataset table, add a
+    // group by condition to prevent a GROUPING ERROR.
     $inner->groupBy('i.sid');
 
     // Remove existing fields and expressions, they are not needed for a count
