From f1bb46172bdc90db00a08c2c78e169952fd22feb Mon Sep 17 00:00:00 2001 From: Fridolyn SOMERS Date: Thu, 7 Mar 2013 16:02:55 +0100 Subject: [PATCH] Bug 7518: certain searches with quotation marks don't work Under certain circumstance, a search term without quotation marks returns the expected results while the same search with a double quote embedded in it would fail. Koha should ignore the quotation marks and return results anyway. This appears when QueryWeightFields syspref is activated (and QueryAutoTruncate is off), as field weighting builds a complex CCL query using double quotes around search words. This patch simply replaces double quotes in search words by a space. Test plan : - Set QueryAutoTruncate off (you may also need to set QueryFuzzy to off) - Set QueryWeightFields off - Perform a serch on two words where you have results, like : centre "ville => you get results - Set QueryWeightFields on - Perform same serch => you get the same results Signed-off-by: Leila Signed-off-by: Kyle M Hall Signed-off-by: Galen Charlton (cherry picked from commit 868855df4b674b495966c022392068c2fdd3a35f) Signed-off-by: Fridolin Somers --- C4/Search.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/C4/Search.pm b/C4/Search.pm index 64c5c5c381..18a0f5f232 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -847,6 +847,7 @@ sub _build_weighted_query { my $stemming = C4::Context->preference("QueryStemming") || 0; my $weight_fields = C4::Context->preference("QueryWeightFields") || 0; my $fuzzy_enabled = C4::Context->preference("QueryFuzzy") || 0; + $operand =~ s/"/ /g; # Bug 7518: searches with quotation marks don't work my $weighted_query .= "(rk=("; # Specifies that we're applying rank -- 2.39.5