Bugzilla – Attachment 106432 Details for
Bug 25900
QueryWeightFields creates unnecessary whitespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25900: trim spaces in search with Zebra and QueryWeightFields
Bug-25900-trim-spaces-in-search-with-Zebra-and-Que.patch (text/plain), 1.56 KB, created by
Fridolin Somers
on 2020-06-30 13:20:20 UTC
(
hide
)
Description:
Bug 25900: trim spaces in search with Zebra and QueryWeightFields
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2020-06-30 13:20:20 UTC
Size:
1.56 KB
patch
obsolete
>From dd77d02ffb88df5801f88540db47ec80cbd8db1d Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Tue, 30 Jun 2020 15:14:24 +0200 >Subject: [PATCH] Bug 25900: trim spaces in search with Zebra and > QueryWeightFields > >Search with Zebra and system preference QueryWeightFields on builds a query with surrounding double quotes : q=tree => q="tree". Therefore existing double quotes are replaced by a space : q="tree" => q=" tree ". >Looks like the leading space breaks the search, 0 results. >Experimented on Ubuntu Xenial and Bionic with Indexdata repository so Zebra version is 2.1.4. It might be specific to this version. > >Patch corrects by adding trim on operand after transforming quotes into spaces. > >Test plan : >1) Use Zebra searchengine and enable system preference QueryWeightFields >2) Go to advanced search >3) Search on title two words you know exists in title surrounded by double quotes, like "Order of the Phoenix" >4) With patch you get results, no results without patch >--- > C4/Search.pm | 1 + > 1 file changed, 1 insertion(+) > >diff --git a/C4/Search.pm b/C4/Search.pm >index a9448e483b..fdfd9de533 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -961,6 +961,7 @@ sub _build_weighted_query { > 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 >+ $operand =~ s/^\s+|\s+$//g; # Trim > > my $weighted_query .= "(rk=("; # Specifies that we're applying rank > >-- >2.27.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25900
:
106432
|
114228
|
121529
|
121572