Bug 10500: (follow-up) disable AggressiveMatchOnISBN if UseQueryParser is on
The original patch did not correctly construction ISBN phrase searches when QP is on. Unfortunately, when attempting to fix that, I discovered that there's a deep bug in QP that makes it generate incorrect search queries when combining more than two atoms in with the || operator. Consequently, until that can be fixed, this patch ensures that if UseQueryParser is on, AggressiveMatchOnISBN has no effect. To state it anther way, AggressiveMatchOnISBN works only when QP is not in use. Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
e67463e8b1
commit
036f2a50e1
|
|
@ -633,9 +633,14 @@ sub get_matches {
|
|||
|
||||
next if scalar(@source_keys) == 0;
|
||||
|
||||
# FIXME - because of a bug in QueryParser, an expression ofthe
|
||||
# format 'isbn:"isbn1" || isbn:"isbn2" || isbn"isbn3"...'
|
||||
# does not get parsed correctly, so we will not
|
||||
# do AggressiveMatchOnISBN if UseQueryParser is on
|
||||
@source_keys = C4::Koha::GetVariationsOfISBNs(@source_keys)
|
||||
if ( $matchpoint->{index} =~ /^isbn$/i
|
||||
&& C4::Context->preference('AggressiveMatchOnISBN') );
|
||||
&& C4::Context->preference('AggressiveMatchOnISBN') )
|
||||
&& !C4::Context->preference('UseQueryParser');
|
||||
|
||||
# build query
|
||||
my $query;
|
||||
|
|
@ -643,13 +648,13 @@ sub get_matches {
|
|||
my $searchresults;
|
||||
my $total_hits;
|
||||
if ( $self->{'record_type'} eq 'biblio' ) {
|
||||
my $phr = C4::Context->preference('AggressiveMatchOnISBN') ? ',phr' : q{};
|
||||
|
||||
if ($QParser) {
|
||||
$query = join( " || ",
|
||||
map { "$matchpoint->{'index'}$phr:$_" } @source_keys );
|
||||
map { "$matchpoint->{'index'}:$_" } @source_keys );
|
||||
}
|
||||
else {
|
||||
my $phr = C4::Context->preference('AggressiveMatchOnISBN') ? ',phr' : q{};
|
||||
$query = join( " or ",
|
||||
map { "$matchpoint->{'index'}$phr=$_" } @source_keys );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,4 +198,4 @@ Cataloging:
|
|||
choices:
|
||||
yes: "do"
|
||||
no: "don't"
|
||||
- attempt to match aggressively by trying all variations of the ISBNs in the imported record as a phrase in the ISBN fields of already cataloged records.
|
||||
- attempt to match aggressively by trying all variations of the ISBNs in the imported record as a phrase in the ISBN fields of already cataloged records. Note that this preference has no effect if UseQueryParser is on.
|
||||
|
|
|
|||
Loading…
Reference in New Issue