diff -u b/core/modules/search/lib/Drupal/search/SearchQuery.php b/core/modules/search/lib/Drupal/search/SearchQuery.php --- b/core/modules/search/lib/Drupal/search/SearchQuery.php +++ b/core/modules/search/lib/Drupal/search/SearchQuery.php @@ -18,6 +18,11 @@ * This query is used by search plugins that use the search index (not all * search plugins do, as some use a different searching mechanism). * + * For efficiency, users of this query can run the prepareAndNormalize() + * method to figure out if there are any search results, before fully setting + * up and calling execute() to execute the query. The scoring expressions are + * not needed until the execute() step. + * * The query object is given the tag 'search_$type' and can be further * extended with hook_query_alter(). */ only in patch2: unchanged: --- a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php @@ -209,8 +209,8 @@ public function execute() { } } } - // Only continue if the first pass query matches. - if (!$query->executeFirstPass()) { + // Only continue if the normalize query finds some results. + if (!$query->prepareAndNormalize()) { return array(); }