You are here

public function SolrDocument::getItemId in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/search_api/datasource/SolrDocument.php \Drupal\search_api_solr\Plugin\search_api\datasource\SolrDocument::getItemId()
  2. 4.x src/Plugin/search_api/datasource/SolrDocument.php \Drupal\search_api_solr\Plugin\search_api\datasource\SolrDocument::getItemId()

Retrieves the unique ID of an object from this datasource.

Parameters

\Drupal\Core\TypedData\ComplexDataInterface $item: An object from this datasource.

Return value

string|null The datasource-internal, unique ID of the item. Or NULL if the given item is no valid item of this datasource.

Overrides DatasourceInterface::getItemId

File

src/Plugin/search_api/datasource/SolrDocument.php, line 107

Class

SolrDocument
Represents a datasource which exposes external Solr Documents.

Namespace

Drupal\search_api_solr\Plugin\search_api\datasource

Code

public function getItemId(ComplexDataInterface $item) {
  return $this
    ->getFieldValue($item, 'id_field');
}