Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -365,33 +365,6 @@ public function hasCaseSensitiveRanges()

/// Internal API

/**
* Normalize fancy quotes in a query.
*
* @param string $input String to normalize
*
* @return string
*/
protected function normalizeFancyQuotes($input)
{
// Normalize fancy quotes:
$quotes = [
"\xC2\xAB" => '"', // « (U+00AB) in UTF-8
"\xC2\xBB" => '"', // » (U+00BB) in UTF-8
"\xE2\x80\x98" => "'", // ‘ (U+2018) in UTF-8
"\xE2\x80\x99" => "'", // ’ (U+2019) in UTF-8
"\xE2\x80\x9A" => "'", // ‚ (U+201A) in UTF-8
"\xE2\x80\x9B" => "'", // ? (U+201B) in UTF-8
"\xE2\x80\x9C" => '"', // “ (U+201C) in UTF-8
"\xE2\x80\x9D" => '"', // ” (U+201D) in UTF-8
"\xE2\x80\x9E" => '"', // „ (U+201E) in UTF-8
"\xE2\x80\x9F" => '"', // ? (U+201F) in UTF-8
"\xE2\x80\xB9" => "'", // ‹ (U+2039) in UTF-8
"\xE2\x80\xBA" => "'", // › (U+203A) in UTF-8
];
return strtr($input, $quotes);
}

/**
* Normalize wildcards in a query.
*
Expand Down Expand Up @@ -553,8 +526,6 @@ protected function normalizeColons($input)
*/
protected function prepareForLuceneSyntax($input)
{
$input = $this->normalizeFancyQuotes($input);

// If the user has entered a lone BOOLEAN operator, convert it to lowercase
// so it is treated as a word (otherwise it will trigger a fatal error):
switch (trim($input)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function testNormalization()
['NOT', 'not'], // freestanding operator
['*bad', 'bad'], // leading wildcard
['?bad', 'bad'], // leading wildcard
["\xE2\x80\x9Ca\xE2\x80\x9D", '"a"'],// fancy quotes
["\xE2\x80\x9Ca\xE2\x80\x9D", "\xE2\x80\x9Ca\xE2\x80\x9D"],// no fancy quotes normalization, see VUFIND-1808
// improperly escaped floating braces/brackets:
['a:{a TO b} [ }', 'a:{a TO b} \[ \}'],
// properly escaped floating braces/brackets:
Expand Down
Loading