$query->
searchExpression($this->
getKeywords(),
$this->
getType());
$find =
$query ->
fields('i',
['langcode'
]) ->
fields('hsi',
['section_plugin_id', 'topic_id'
]) // Since SearchQuery makes these into GROUP BY queries, if we add
// a field, for PostgreSQL we also need to make it an aggregate or a
// GROUP BY. In this case, we want GROUP BY.
->
groupBy('i.langcode'
) ->
groupBy('hsi.section_plugin_id'
) ->
groupBy('hsi.topic_id'
) ->
limit(10
) ->
execute();
// Check query status and set messages if needed.
$status =
$query->
getStatus();
if ($status & SearchQuery::EXPRESSIONS_IGNORED
) { $this->messenger->
addWarning($this->
t('Your search used too many AND/OR expressions. Only the first @count terms were included in this search.',
['@count' =>
$this->searchSettings->
get('and_or_limit'
)]));
} if ($status & SearchQuery::LOWER_CASE_OR
) { $this->messenger->
addWarning($this->
t('Search for either of the two terms with uppercase <strong>OR</strong>. For example, <strong>cats OR dogs</strong>.'
));
}