You are here

public function StreamingExpressionBuilder::_merge 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::_merge()
  2. 4.x src/Utility/StreamingExpressionBuilder.php \Drupal\search_api_solr\Utility\StreamingExpressionBuilder::_merge()

Eases merge() streaming expressions by applying required sorts.

Parameters

string $stream1: A streaming expression as string.

string $stream2: A streaming expression as string.

string $field: The Search API field name or Solr reserved field name to use for the intersection.

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

Return value

string A chainable streaming expression as string.

File

src/Utility/StreamingExpressionBuilder.php, line 526

Class

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

Namespace

Drupal\search_api_solr\Utility

Code

public function _merge(string $stream1, string $stream2, string $field, string $language_id = LanguageInterface::LANGCODE_NOT_SPECIFIED) {
  $solr_field = $this
    ->_field($field, $language_id);
  return $this
    ->merge($this
    ->sort($stream1, 'by="' . $solr_field . ' ASC"'), $this
    ->sort($stream2, 'by="' . $solr_field . ' ASC"'), 'on="' . $solr_field . ' ASC"');
}