Commit 058c6f51 authored by Bas de Nooijer's avatar Bas de Nooijer

Added escaping of forward slashes, these were introduced in Solr 4 regex support.

parent c00e7231
......@@ -103,7 +103,7 @@ class Helper
*/
public function escapeTerm($input)
{
$pattern = '/(\+|-|&&|\|\||!|\(|\)|\{|}|\[|]|\^|"|~|\*|\?|:|\\\)/';
$pattern = '/(\+|-|&&|\|\||!|\(|\)|\{|}|\[|]|\^|"|~|\*|\?|:|\/|\\\)/';
return preg_replace($pattern, '\\\$1', $input);
}
......
......@@ -207,8 +207,8 @@ class HelperTest extends \PHPUnit_Framework_TestCase
public function testEscapeTerm()
{
$this->assertEquals(
'a\\+b',
$this->helper->escapeTerm('a+b')
'a\\+b\/c',
$this->helper->escapeTerm('a+b/c')
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment