Bugzilla – Attachment 22933 Details for
Bug 11137
QueryParser can ignore parts of a Boolean search after the first
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11137: fix certain types of searches run using QueryParser
Bug-11137-fix-certain-types-of-searches-run-using-.patch (text/plain), 3.86 KB, created by
Jonathan Druart
on 2013-11-14 14:47:56 UTC
(
hide
)
Description:
Bug 11137: fix certain types of searches run using QueryParser
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-11-14 14:47:56 UTC
Size:
3.86 KB
patch
obsolete
>From b135fcdf27d49ce1296a271fc0db3e1f7399fc67 Mon Sep 17 00:00:00 2001 >From: Galen Charlton <gmc@esilibrary.com> >Date: Thu, 24 Oct 2013 20:42:38 +0000 >Subject: [PATCH] Bug 11137: fix certain types of searches run using > QueryParser > >QueryParser was loading redundant search aliases, which in turn resulted >in certain queries involving two or more clauses joined by a Boolean >operator getting parsed in correctly. > >To test: > >[1] Enable QueryParser. >[2] Arrange your database so that some some bib records contain > the keyword 'history' while a smaller subset contain > both 'history' and 'earth'. (The exact words used don't > matter.) >[3] Run the following search from the OPAC global search bar: > > kw:history && kw:earth > >[4] Observe that the records that are returned include *all* bibs > in the database with the keyword 'history'. In other words, the > restriction that the records must also contain 'earth' is not > observed. >[5] Apply the patch and rerun the search. >[6] This time, the results that are returned should include only those > that contain both 'history' and 'earth'. >[7] Verify that prove -v t/QueryParser.t passes. > >Signed-off-by: Galen Charlton <gmc@esilibrary.com> >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >Passes test plans, all tests and QA script. >Also checked the db_dependent/Search.t tests. >Tried some other searches, all seems to be working correctly. > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >I reproduce the bug and I confirm this patch fixes it. >Without the patch, kw:history && kw:earth, I got: > Search biblios OK 4 1 1+0 RPN @attrset Bib-1 @attr 4=6 @attr 1=1016 history >With the path, I get: > Search biblios OK 2 1 1+0 RPN @attrset Bib-1 @and @attr 4=6 @attr 1=1016 history @attr 4=6 @attr 1=1016 earth >--- > Koha/QueryParser/Driver/PQF.pm | 6 ------ > t/QueryParser.t | 4 +--- > t/db_dependent/Search.t | 2 +- > 3 files changed, 2 insertions(+), 10 deletions(-) > >diff --git a/Koha/QueryParser/Driver/PQF.pm b/Koha/QueryParser/Driver/PQF.pm >index cd3b994..8181cd3 100644 >--- a/Koha/QueryParser/Driver/PQF.pm >+++ b/Koha/QueryParser/Driver/PQF.pm >@@ -111,7 +111,6 @@ sub add_bib1_field_map { > my ($self, $class, $field, $server, $attributes) = @_; > > $self->add_search_field( $class => $field ); >- $self->add_search_field_alias( $class => $field => $field ); > return $self->_add_field_mapping($self->bib1_field_map, $class, $field, $server, $attributes); > } > >@@ -542,14 +541,9 @@ sub initialize { > $self->add_bib1_field_map( > $class => $field => $server => $bib1_mapping ); > } >- $self->add_search_field_alias( $class => $field => >- $field_mappings->{$class}->{$field}->{'index'} ); > foreach my $alias ( > @{ $field_mappings->{$class}->{$field}->{'aliases'} } ) > { >- next >- if ( $alias eq >- $field_mappings->{$class}->{$field}->{'index'} ); > $self->add_search_field_alias( $class => $field => $alias ); > } > } >diff --git a/t/QueryParser.t b/t/QueryParser.t >index f0935ec..41782f2 100644 >--- a/t/QueryParser.t >+++ b/t/QueryParser.t >@@ -44,9 +44,7 @@ my $desired_config = { > 'field_mappings' => { > 'author' => { > 'personal' => { >- 'aliases' => [ >- 'personal' >- ], >+ 'aliases' => [ ], > 'bib1_mapping' => { > 'biblioserver' => { > '1' => '1004' >diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t >index 66d4259..378fc2d 100644 >--- a/t/db_dependent/Search.t >+++ b/t/db_dependent/Search.t >@@ -12,7 +12,7 @@ use YAML; > use C4::Debug; > require C4::Context; > >-use Test::More tests => 198; >+use Test::More tests => 200; > use Test::MockModule; > use MARC::Record; > use File::Spec; >-- >1.7.10.4
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 11137
:
22380
|
22381
|
22383
|
22384
|
22438
|
22439
|
22932
| 22933