You are here

protected function SearchApiElasticsearchBackend::createId in Elasticsearch Connector 8

Creates an ID used as the unique identifier at the Solr server.

This has to consist of both index and item ID. Optionally, the site hash is also included.

See also

elasticsearch_site_hash()

File

src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php, line 554
Contains the SearchApiElasticsearchBackend object.

Class

SearchApiElasticsearchBackend
Plugin annotation @SearchApiBackend( id = "elasticsearch", label = @Translation("Elasticsearch"), description = @Translation("Index items using an Elasticsearch server.") )

Namespace

Drupal\elasticsearch_connector\Plugin\search_api\backend

Code

protected function createId($index_id, $item_id) {
  $site_hash = !empty($this->configuration['site_hash']) ? elasticsearch_site_hash() . '-' : '';
  return "{$site_hash}{$index_id}-{$item_id}";
}