Bugzilla – Attachment 20199 Details for
Bug 10688
QueryParser doesn't recognize QP queries when used in a fielded search box
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10688: Don't prefix index inappropriately
Bug-10688-Dont-prefix-index-inappropriately.patch (text/plain), 1.84 KB, created by
Chris Cormack
on 2013-08-08 22:42:46 UTC
(
hide
)
Description:
Bug 10688: Don't prefix index inappropriately
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2013-08-08 22:42:46 UTC
Size:
1.84 KB
patch
obsolete
>From f915b50e4a0d22c77bf6461e448e5cc004fbc91b Mon Sep 17 00:00:00 2001 >From: Jared Camins-Esakov <jcamins@cpbibliography.com> >Date: Tue, 6 Aug 2013 00:48:20 -0400 >Subject: [PATCH] Bug 10688: Don't prefix index inappropriately > >If you select an index in the search dropdown and then enter in a QP >query starting with the field, Koha will prepend the index you do not >want to use at the beginning of the search, resulting in a search that >problem does not match what you were hoping for. > >To test: >1) Select an index in the search dropdown in the OPAC. Author is fine. >2) Enter a search term using manually entered indexes. For example: > ti:cat in the hat >3) Note that the search fails. >4) Apply patch. >5) Repeat steps 1 and 2. >6) Note that the search succeeds. >7) Sign off. > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > C4/Search.pm | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index aec024b..c2afe05 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -1187,7 +1187,10 @@ sub parseQuery { > next unless $operands[$ii]; > $query .= $operators[ $ii - 1 ] eq 'or' ? ' || ' : ' && ' > if ($query); >- if ( $indexes[$ii] =~ m/su-/ ) { >+ if ( $operands[$ii] =~ /^[^"]\W*[-|_\w]*:\w.*[^"]$/ ) { >+ $query .= $operands[$ii]; >+ } >+ elsif ( $indexes[$ii] =~ m/su-/ ) { > $query .= $indexes[$ii] . '(' . $operands[$ii] . ')'; > } > else { >@@ -1280,7 +1283,7 @@ sub buildQuery { > > my $cclq = 0; > my $cclindexes = getIndexes(); >- if ( $query !~ /\s*ccl=/ ) { >+ if ( $query !~ /\s*(ccl=|pqf=|cql=)/ ) { > while ( !$cclq && $query =~ /(?:^|\W)([\w-]+)(,[\w-]+)*[:=]/g ) { > my $dx = lc($1); > $cclq = grep { lc($_) eq $dx } @$cclindexes; >-- >1.8.1.2
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 10688
:
20123
|
20199
|
20423