Browse Source

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 036f2a50e1
  Author: Galen Charlton <gmc@esilibrary.com>
  Date:   Mon May 5 19:31:00 2014 +0000
      Bug 10500: (follow-up) disable AggressiveMatchOnISBN if
      UseQueryParser is on

Signed-off-by: Morag Hills <the.invinnysible.one@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
3.20.x
Jonathan Druart 10 years ago
committed by Tomas Cohen Arazi
parent
commit
97f836ef99
  1. 7
      C4/Search.pm
  2. 1
      installer/data/mysql/sysprefs.sql
  3. 10
      installer/data/mysql/updatedatabase.pl
  4. 7
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref

7
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){

1
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 <style> tag.','free'),
('SCOUserJS','',NULL,'Define custom javascript for inclusion in the SCO module','free'),
('SearchMyLibraryFirst','0',NULL,'If ON, OPAC searches return results limited by the user\'s library by default if they are logged in','YesNo'),
('SearchWithISBNVariations','0',NULL,'If enabled, search on all variations of the ISBN','YesNo'),
('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'),
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),

10
installer/data/mysql/updatedatabase.pl

@ -10025,6 +10025,16 @@ if ( CheckVersion($DBversion) ) {
SetVersion ($DBversion);
}
$DBversion = "3.19.00.XXX";
if ( CheckVersion($DBversion) ) {
$dbh->do(q|
INSERT INTO systempreferences ( variable, value, options, explanation, type ) VALUES
('SearchWithISBNVariations','0',NULL,'If enabled, search on all variations of the ISBN','YesNo')
|);
print "Upgrade to $DBversion done (Bug 13528 - Add the SearchWithISBNVariations syspref)\n";
SetVersion ($DBversion);
}
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.

7
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref

@ -214,3 +214,10 @@ Searching:
- Use the following text as separator for UNIMARC authors facets
- pref: UNIMARCAuthorsFacetsSeparator
class: short
-
- When searching on the ISBN index,
- pref: SearchWithISBNVariations
choices:
yes: "search"
no: "don't search"
- on all variations of the ISBN. Note that this preference has no effect if UseQueryParser is on.

Loading…
Cancel
Save