You are here

public function StreamingExpressionBuilder::_field in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 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:

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 to be used in 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 150

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) {
  if (!isset($this->field_name_mapping[$search_api_field_name])) {
    if (isset($this->sort_fields[$search_api_field_name])) {
      return $this->sort_fields[$search_api_field_name];
    }
    else {
      throw new \InvalidArgumentException(sprintf('Field %s does not exist in index %s.', $search_api_field_name, $this->index
        ->id()));
    }
  }
  return $this->field_name_mapping[$search_api_field_name];
}