You are here

public function StreamingExpressionBuilder::_commit in Search API Solr 4.x

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

Applies the commit decorator to the incoming stream.

Parameters

string $stream: The stream value.

array $options: The option keys are the ones from the Solr documentation, prefixed with "commit.".

Return value

string A chainable streaming expression as string.

See also

https://lucene.apache.org/solr/guide/7_3/stream-decorator-reference.html...

1 call to StreamingExpressionBuilder::_commit()
StreamingExpressionBuilder::_commit_update in src/Utility/StreamingExpressionBuilder.php
A shorthand for _update() and _commit().

File

src/Utility/StreamingExpressionBuilder.php, line 623

Class

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

Namespace

Drupal\search_api_solr\Utility

Code

public function _commit(string $stream, array $options = []) {
  $options += [
    'commit.batchSize' => 0,
    'commit.waitFlush' => FALSE,
    'commit.waitSearcher' => FALSE,
    'commit.softCommit' => FALSE,
  ];
  return $this
    ->commit($this
    ->_collection(), 'batchSize=' . $options['commit.batchSize'], 'waitFlush=' . ($options['commit.waitFlush'] ? 'true' : 'false'), 'waitSearcher=' . ($options['commit.waitSearcher'] ? 'true' : 'false'), 'softCommit=' . ($options['commit.softCommit'] ? 'true' : 'false'), $stream);
}