You are here

public function SearchApiSolrBackend::getIndexFilterQueryString in Search API Solr 8.3

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

Returns a ready to use query string to filter results by index and site.

Parameters

\Drupal\search_api\IndexInterface $index: The Search API index entity.

Return value

string The query string filter.

Overrides SolrBackendInterface::getIndexFilterQueryString

2 calls to SearchApiSolrBackend::getIndexFilterQueryString()
SearchApiSolrBackend::getCollectionEndpoint in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Returns the endpoint to use for the index.
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 1199

Class

SearchApiSolrBackend
Apache Solr backend for search api.

Namespace

Drupal\search_api_solr\Plugin\search_api\backend

Code

public function getIndexFilterQueryString(IndexInterface $index) {
  $fq = '+index_id:' . $this->queryHelper
    ->escapeTerm($this
    ->getTargetedIndexId($index));

  // Set the site hash filter, if enabled.
  if ($this->configuration['site_hash']) {
    $fq .= ' +hash:' . $this->queryHelper
      ->escapeTerm($this
      ->getTargetedSiteHash($index));
  }
  return $fq;
}