You are here

public static function SolrDocumentDefinition::create in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 src/TypedData/SolrDocumentDefinition.php \Drupal\search_api_solr\TypedData\SolrDocumentDefinition::create()
  2. 8.2 src/TypedData/SolrDocumentDefinition.php \Drupal\search_api_solr\TypedData\SolrDocumentDefinition::create()

Creates a new Solr document definition.

Parameters

string $index_id: The Search Api index the Solr document definition belongs to.

Return value

static

Overrides DataDefinition::create

2 calls to SolrDocumentDefinition::create()
SolrDocument::createFromItem in src/Plugin/DataType/SolrDocument.php
Creates an instance wrapping the given Item.
SolrDocumentDefinition::createFromDataType in src/TypedData/SolrDocumentDefinition.php
Creates a new data definition object.

File

src/TypedData/SolrDocumentDefinition.php, line 28

Class

SolrDocumentDefinition
A typed data definition class for describing Solr documents.

Namespace

Drupal\search_api_solr\TypedData

Code

public static function create($index_id = NULL) {
  $definition['type'] = $index_id ? 'solr_document:' . $index_id : 'solr_document';
  $document_definition = new static($definition);
  if ($index_id) {
    $document_definition
      ->setIndexId($index_id);
  }
  return $document_definition;
}