You are here

protected function SolrFieldType::getCollatedField in Search API Solr 8.3

Same name and namespace in other branches
  1. 4.x src/Entity/SolrFieldType.php \Drupal\search_api_solr\Entity\SolrFieldType::getCollatedField()

Returns the collated field definition.

Parameters

int|null $solr_major_version:

Return value

array|null The array containing the collated field definition or null if is not configured for this field type.

1 call to SolrFieldType::getCollatedField()
SolrFieldType::getDynamicFields in src/Entity/SolrFieldType.php
Gets a list of dynamic Solr fields that will use this Solr Field Type.

File

src/Entity/SolrFieldType.php, line 524

Class

SolrFieldType
Defines the SolrFieldType entity.

Namespace

Drupal\search_api_solr\Entity

Code

protected function getCollatedField(?int $solr_major_version = NULL) {
  $collated_field = NULL;
  if ($this->collated_field_type) {
    $collated_field = [
      'name' => SearchApiSolrUtility::encodeSolrName('sort' . SolrBackendInterface::SEARCH_API_SOLR_LANGUAGE_SEPARATOR . $this->field_type_language_code) . '_*',
      'type' => $this->collated_field_type['name'],
      'stored' => FALSE,
      'indexed' => $solr_major_version === 4,
    ];
    if ($solr_major_version !== 4) {
      $collated_field['docValues'] = TRUE;
    }
  }
  return $collated_field;
}