You are here

public function SearchApiSolrBackend::getDocument in Search API Solr 8.2

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

Retrieves a Solr document from an search api index item.

Parameters

\Drupal\search_api\IndexInterface $index: The search api index.

\Drupal\search_api\Item\ItemInterface $item: An item to get documents for.

Return value

\Solarium\QueryType\Update\Query\Document\Document A solr document.

Overrides SolrBackendInterface::getDocument

File

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

Class

SearchApiSolrBackend
Apache Solr backend for search api.

Namespace

Drupal\search_api_solr\Plugin\search_api\backend

Code

public function getDocument(IndexInterface $index, ItemInterface $item) {
  $documents = $this
    ->getDocuments($index, [
    $item
      ->getId() => $item,
  ]);
  return reset($documents);
}