You are here

public function SolrDocumentFactory::create in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 src/SolrDocumentFactory.php \Drupal\search_api_solr\SolrDocumentFactory::create()
  2. 4.x src/SolrDocumentFactory.php \Drupal\search_api_solr\SolrDocumentFactory::create()

Creates a SolrDocument data type from a Search API result Item.

Parameters

\Drupal\search_api\Item\ItemInterface $item: The result item to be wrapped with the data type class.

Return value

\Drupal\search_api_solr\Plugin\DataType\SolrDocument The wrapped item.

Overrides SolrDocumentFactoryInterface::create

File

src/SolrDocumentFactory.php, line 33

Class

SolrDocumentFactory
Defines a class for a Solr Document factory.

Namespace

Drupal\search_api_solr

Code

public function create(ItemInterface $item) {
  $plugin = $this->typedDataManager
    ->getDefinition('solr_document')['class'];
  return $plugin::createFromItem($item);
}