You are here

public static function DrupalApacheSolrService::escapePhrase in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 Drupal_Apache_Solr_Service.php \DrupalApacheSolrService::escapePhrase()
  2. 7 Drupal_Apache_Solr_Service.php \DrupalApacheSolrService::escapePhrase()

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

Parameters

string $value:

Return value

string

1 call to DrupalApacheSolrService::escapePhrase()
DrupalApacheSolrService::phrase in ./Drupal_Apache_Solr_Service.php
Convenience function for creating phrase syntax from a value

File

./Drupal_Apache_Solr_Service.php, line 558

Class

DrupalApacheSolrService
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);
}