You are here

public static function Utility::hasIndexJustSolrDocumentDatasource in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::hasIndexJustSolrDocumentDatasource()

Returns whether the index only contains "solr_document" datasources.

Parameters

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

Return value

bool TRUE if the index only contains "solr_document" datasources, FALSE otherwise.

5 calls to Utility::hasIndexJustSolrDocumentDatasource()
SearchApiSolrBackend::getRequiredFields in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Get the list of fields Solr must return as result.
SearchApiSolrBackend::hasIndexJustSolrDocumentDatasource in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Returns whether the index only contains "solr_document" datasources.
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:
StreamingExpressionBuilder::__construct in src/Utility/StreamingExpressionBuilder.php
StreamingExpressionBuilder constructor.
Utility::getSortableSolrField in src/Utility/Utility.php
Gets the sortable equivalent of a dynamic Solr field.

File

src/Utility/Utility.php, line 1027

Class

Utility
Provides various helper functions for Solr backends.

Namespace

Drupal\search_api_solr\Utility

Code

public static function hasIndexJustSolrDocumentDatasource(IndexInterface $index) : bool {
  static $datasources = [];
  if (!isset($datasources[$index
    ->id()])) {
    $datasource_ids = $index
      ->getDatasourceIds();
    $datasources[$index
      ->id()] = 1 === count($datasource_ids) && in_array('solr_document', $datasource_ids);
  }
  return $datasources[$index
    ->id()];
}