From a11150d8ab36eba474655896a10b6712d1983ec0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 22 Dec 2014 15:56:41 +0100 Subject: [PATCH] [PASSED QA] Bug 13528: Use the different isbn variations on search on the isbn index (nb) This enhancement adds the ability to search on all isbn variations when searching on the isbn index. Test plan: 0/ Don't apply the patch 1/ Create or choose a notice with an isbn with dashes. 2/ Try to search the notice using the isbn index by it isbn without dashes. => It does not work. 3/ Apply the patch, enable the new pref SearchWithISBNVariations and disable UseQueryParser. 4/ repeat 2 and note that the record is now returned. Note that this only works if UseQueryParser is disabled. It looks like QueryParser does not manage more than 1 operator. See: QueryParser does not manage more than 1 operator? http://lists.koha-community.org/pipermail/koha-devel/2014-December/041028.html and commit 036f2a50e11dab97ef8509f2f585c4cc407ea728 Author: Galen Charlton Date: Mon May 5 19:31:00 2014 +0000 Bug 10500: (follow-up) disable AggressiveMatchOnISBN if UseQueryParser is on Signed-off-by: Morag Hills Signed-off-by: Kyle M Hall --- C4/Search.pm | 7 +++++++ installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 10 ++++++++++ .../en/modules/admin/preferences/searching.pref | 7 +++++++ 4 files changed, 25 insertions(+), 0 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 5216a12..2a5cb50 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1569,6 +1569,13 @@ sub buildQuery { $remove_stopwords ) = ( 0, 0, 0, 0, 0 ); + if ( $index eq 'nb' ) { + if ( C4::Context->preference("SearchWithISBNVariations") ) { + my @isbns = C4::Koha::GetVariationsOfISBN( $operand ); + $operands[$i] = $operand = '(nb=' . join(' OR nb=', @isbns) . ')'; + $indexes[$i] = $index = ''; + } + } } if(not $index){ diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 89707ef..ab490ea 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -367,6 +367,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded