You are here

protected function SearchApiSolrBackend::applySearchWorkarounds in Search API Solr 8.3

Same name and namespace in other branches
  1. 8 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::applySearchWorkarounds()
  2. 8.2 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::applySearchWorkarounds()
  3. 4.x src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::applySearchWorkarounds()

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.

3 calls to SearchApiSolrBackend::applySearchWorkarounds()
SearchApiSolrBackend::executeGraphStreamingExpression in src/Plugin/search_api/backend/SearchApiSolrBackend.php
SearchApiSolrBackend::executeStreamingExpression in src/Plugin/search_api/backend/SearchApiSolrBackend.php
SearchApiSolrBackend::search in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Options on $query prefixed by 'solr_param_' will be passed natively to Solr as query parameter without the prefix. For example you can set the "Minimum Should Match" parameter 'mm' to '75%' like this:

File

src/Plugin/search_api/backend/SearchApiSolrBackend.php, line 1661

Class

SearchApiSolrBackend
Apache Solr backend for search api.

Namespace

Drupal\search_api_solr\Plugin\search_api\backend

Code

protected function applySearchWorkarounds(SolariumQueryInterface $solarium_query, QueryInterface $query) {
  $solarium_query
    ->setTimeZone(Utility::getTimeZone($query
    ->getIndex()));

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

  /* We keep this as an example.
      $connector = $this->getSolrConnector();
      $schema_version = $connector->getSchemaVersion();
      $solr_version = $connector->getSolrVersion();

      // Schema versions before 4.4 set the default query operator to 'AND'. But
      // incompatibilities since Solr 5.5.0 required a new query builder that
      // bases on 'OR'.
      // @see https://www.drupal.org/node/2724117
      if (version_compare($schema_version, '4.4', '<')) {
      $params = $solarium_query->getParams();
      if (!isset($params['q.op'])) {
      $solarium_query->addParam('q.op', 'OR');
      }
      }
       */
}