You are here

protected function DoubleQuoteWorkaround::process in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/search_api/processor/DoubleQuoteWorkaround.php \Drupal\search_api_solr\Plugin\search_api\processor\DoubleQuoteWorkaround::process()
  2. 4.x src/Plugin/search_api/processor/DoubleQuoteWorkaround.php \Drupal\search_api_solr\Plugin\search_api\processor\DoubleQuoteWorkaround::process()

Processes a single string value.

This method is ultimately called for all text by the standard implementation, and does nothing by default.

Parameters

mixed $value: The value to preprocess, as a reference. Can be manipulated directly, nothing has to be returned. Since this can be called for all value types, $value has to remain the same type. The possible types for $value depend on shouldProcess().

Overrides FieldsProcessorPluginBase::process

See also

\Drupal\search_api\Processor\FieldsProcessorPluginBase::shouldProcess()

File

src/Plugin/search_api/processor/DoubleQuoteWorkaround.php, line 76

Class

DoubleQuoteWorkaround
Replaces double quotes in field values and query to work around a bug in Solr streaming expressions.

Namespace

Drupal\search_api_solr\Plugin\search_api\processor

Code

protected function process(&$value) {

  // do *not* turn a value of null into an empty string!
  if (is_string($value)) {
    $value = preg_replace('/"/u', $this->configuration['replacement'], $value);
  }
}