You are here

public static function SearchApiSolrConnection::escapePhrase in Search API Solr 7

Escapes a string that should be included in a Solr phrase.

In contrast to escape(), this only escapes '"' and '\'.

Parameters

string $value: The string to escape.

Return value

string An escaped string suitable for passing to Solr.

Overrides SearchApiSolrConnectionInterface::escapePhrase

1 call to SearchApiSolrConnection::escapePhrase()
SearchApiSolrConnection::phrase in includes/solr_connection.inc
Converts a string to a Solr phrase.

File

includes/solr_connection.inc, line 694

Class

SearchApiSolrConnection
Represents a Solr server resource.

Code

public static function escapePhrase($value) {
  $replacements['"'] = '\\"';
  $replacements["\\"] = "\\\\";
  return strtr($value, $replacements);
}