From f8b4ef506bfe083816197e9c531f1523d5e629c0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 7 Apr 2014 16:07:20 +0200 Subject: [PATCH] Bug 11944: Facets and resort This patch should fix facets and resort encoding issues. Note: This patch will certainly break the search history --- C4/Search.pm | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 144dbde..30e4158 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -518,6 +518,8 @@ sub getRecords { next; } + SetUTF8Flag($marc_record); + my @used_datas = (); foreach my $tag ( @{ $facet->{tags} } ) { @@ -1305,17 +1307,17 @@ sub buildQuery { if ( @limits ) { $q .= ' and '.join(' and ', @limits); } - return ( undef, $q, $q, "q=ccl=".uri_escape_utf8($q), $q, '', '', '', '', 'ccl' ); + return ( undef, $q, $q, "q=ccl=".$q, $q, '', '', '', '', 'ccl' ); } if ( $query =~ /^cql=/ ) { - return ( undef, $', $', "q=cql=".uri_escape_utf8($'), $', '', '', '', '', 'cql' ); + return ( undef, $', $', "q=cql=".$', $', '', '', '', '', 'cql' ); } if ( $query =~ /^pqf=/ ) { if ($query_desc) { - $query_cgi = "q=".uri_escape_utf8($query_desc); + $query_cgi = "q=".$query_desc; } else { $query_desc = $'; - $query_cgi = "q=pqf=".uri_escape_utf8($'); + $query_cgi = "q=pqf=".$'; } return ( undef, $', $', $query_cgi, $query_desc, '', '', '', '', 'pqf' ); } @@ -1487,9 +1489,9 @@ sub buildQuery { $query .= " $operators[$i-1] "; $query .= " $index_plus " unless $indexes_set; $query .= " $operand"; - $query_cgi .= "&op=".uri_escape_utf8($operators[$i-1]); - $query_cgi .= "&idx=".uri_escape_utf8($index) if $index; - $query_cgi .= "&q=".uri_escape_utf8($operands[$i]) if $operands[$i]; + $query_cgi .= "&op=".$operators[$i-1]; + $query_cgi .= "&idx=".$index if $index; + $query_cgi .= "&q=".$operands[$i] if $operands[$i]; $query_desc .= " $operators[$i-1] $index_plus $operands[$i]"; } @@ -1499,8 +1501,8 @@ sub buildQuery { $query .= " and "; $query .= "$index_plus " unless $indexes_set; $query .= "$operand"; - $query_cgi .= "&op=and&idx=".uri_escape_utf8($index) if $index; - $query_cgi .= "&q=".uri_escape_utf8($operands[$i]) if $operands[$i]; + $query_cgi .= "&op=and&idx=".$index if $index; + $query_cgi .= "&q=".$operands[$i] if $operands[$i]; $query_desc .= " and $index_plus $operands[$i]"; } } @@ -1512,8 +1514,8 @@ sub buildQuery { $query .= " $index_plus " unless $indexes_set; $query .= $operand; $query_desc .= " $index_plus $operands[$i]"; - $query_cgi .= "&idx=".uri_escape_utf8($index) if $index; - $query_cgi .= "&q=".uri_escape_utf8($operands[$i]) if $operands[$i]; + $query_cgi .= "&idx=".$index if $index; + $query_cgi .= "&q=".$operands[$i] if $operands[$i]; $previous_operand = 1; } } #/if $operands -- 1.7.10.4