Bug 11175: Search using double quotes to support Elasticsearch
With Elasticsearch if you would use the search string here without the change to double quotes, i.e. (rcn='1234' AND cni='FI-XXX') OR rcn='FI-XXX 1234' then the search would somehow manage to return a record with 001 = 1234 and 003 = FI-XXX. Using double quotes prevents that. Also using parenthesis around the latter part of the OR seems to work: (rcn='1234' AND cni='FI-XXX') OR (rcn='FI-XXX 1234') Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
d21e919ba6
commit
a819ae07a6
|
|
@ -45,11 +45,11 @@ sub get_component_part_query {
|
|||
|
||||
if (!defined($pf003)) {
|
||||
# search for 773$w='Host001'
|
||||
$searchstr = "rcn='".$pf001->data()."'";
|
||||
$searchstr = "rcn=\"".$pf001->data()."\"";
|
||||
} else {
|
||||
# search for (773$w='Host001' and 003='Host003') or 773$w='Host003 Host001')
|
||||
$searchstr = "(rcn='".$pf001->data()."' AND cni='".$pf003->data()."')";
|
||||
$searchstr .= " OR rcn='".$pf003->data()." ".$pf001->data()."'";
|
||||
$searchstr = "(rcn=\"".$pf001->data()."\" AND cni=\"".$pf003->data()."\")";
|
||||
$searchstr .= " OR rcn=\"".$pf003->data()." ".$pf001->data()."\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,5 +38,5 @@ subtest 'get_component_part_query' => sub {
|
|||
$record->append_fields($marc_001_field);
|
||||
ModBiblioMarc($record, $biblionumber);
|
||||
|
||||
is(Koha::Util::Search::get_component_part_query($biblionumber), "rcn='$biblionumber'");
|
||||
is(Koha::Util::Search::get_component_part_query($biblionumber), "rcn=\"$biblionumber\"");
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue