You are here

protected function SearchApiSolrAnySchemaBackend::applySearchWorkarounds in Search API Solr 8.2

Apply workarounds for special Solr versions before searching.

Parameters

\Solarium\Core\Query\QueryInterface $solarium_query: The Solarium select query object.

\Drupal\search_api\Query\QueryInterface $query: The \Drupal\search_api\Query\Query object representing the executed search query.

Overrides SearchApiSolrBackend::applySearchWorkarounds

File

src/Plugin/search_api/backend/SearchApiSolrAnySchemaBackend.php, line 99

Class

SearchApiSolrAnySchemaBackend
A read-only backend for any non-drupal schema.

Namespace

Drupal\search_api_solr\Plugin\search_api\backend

Code

protected function applySearchWorkarounds(SolariumQueryInterface $solarium_query, QueryInterface $query) {
  parent::applySearchWorkarounds($solarium_query, $query);

  // Do not modify 'Server index status' queries.
  // @see https://www.drupal.org/node/2668852
  if ($query
    ->hasTag('server_index_status')) {
    return;
  }

  // The query builder of Search API Solr Search bases on 'OR' which is the
  // default value for solr, too. But a foreign schema could have a
  // non-default config for q.op. Therefor we need to set it explicitly if not
  // set.
  $params = $solarium_query
    ->getParams();
  if (!isset($params['q.op'])) {
    $solarium_query
      ->addParam('q.op', 'OR');
  }
}