You are here

public static function Apache_Solr_Service::escapePhrase in Apache Solr Search 5

Escape a value meant to be contained in a phrase for special query characters

Parameters

string $value:

Return value

string

2 calls to Apache_Solr_Service::escapePhrase()
Apache_Solr_Service::phrase in SolrPhpClient/Apache/Solr/Service.php
Convenience function for creating phrase syntax from a value
Apache_Solr_Service_Balancer::escapePhrase in SolrPhpClient/Apache/Solr/Service/Balancer.php
Escape a value meant to be contained in a phrase for special query characters

File

SolrPhpClient/Apache/Solr/Service.php, line 173

Class

Apache_Solr_Service
Starting point for the Solr API. Represents a Solr server resource and has methods for pinging, adding, deleting, committing, optimizing and searching.

Code

public static function escapePhrase($value) {
  $pattern = '/("|\\\\)/';
  $replace = '\\\\$1';
  return preg_replace($pattern, $replace, $value);
}