You are here

public function StreamingExpressionBuilder::_field in Search API Solr 8.3

Same name and namespace in other branches
  1. 8.2 src/Utility/StreamingExpressionBuilder.php \Drupal\search_api_solr\Utility\StreamingExpressionBuilder::_field()
  2. 4.x src/Utility/StreamingExpressionBuilder.php \Drupal\search_api_solr\Utility\StreamingExpressionBuilder::_field()

Converts a Search API field name into a Solr field name.

Parameters

string $search_api_field_name: The Search API field name.

string $language_id: (optional) The language ID. Defaults to "und".

Return value

string The Solr field name.

Throws

\InvalidArgumentException

7 calls to StreamingExpressionBuilder::_field()
StreamingExpressionBuilder::_field_escaped_value in src/Utility/StreamingExpressionBuilder.php
Formats a field and its escaped value for a Solr streaming expression.
StreamingExpressionBuilder::_field_list in src/Utility/StreamingExpressionBuilder.php
Formats a list of Search API field names into a string of Solr field names.
StreamingExpressionBuilder::_field_value in src/Utility/StreamingExpressionBuilder.php
Formats a field and its value to be used in a Solr streaming expression.
StreamingExpressionBuilder::_intersect in src/Utility/StreamingExpressionBuilder.php
Eases intersect() streaming expressions by applying required sorts.
StreamingExpressionBuilder::_merge in src/Utility/StreamingExpressionBuilder.php
Eases merge() streaming expressions by applying required sorts.

... See full list

File

src/Utility/StreamingExpressionBuilder.php, line 249

Class

StreamingExpressionBuilder
Provides methods for creating streaming expressions targeting a given index.

Namespace

Drupal\search_api_solr\Utility

Code

public function _field(string $search_api_field_name, string $language_id = LanguageInterface::LANGCODE_NOT_SPECIFIED) {
  if (!isset($this->allFieldsIncludingGraphFieldsMapped[$language_id][$search_api_field_name])) {
    if (isset($this->sortFieldsMapped[$language_id][$search_api_field_name])) {
      return $this->sortFieldsMapped[$language_id][$search_api_field_name];
    }
    throw new \InvalidArgumentException(sprintf('Field %s does not exist in index %s.', $search_api_field_name, $this->targetedIndexId));
  }
  return $this->allFieldsIncludingGraphFieldsMapped[$language_id][$search_api_field_name];
}