From cc7fb7a7fbe90035b927d78f92475c93f5aedc45 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 2 Nov 2020 14:59:33 +0000 Subject: [PATCH] Bug 11175: Add Elasticsearch support Signed-off-by: Nick Clemens Signed-off-by: Pasi Kallinen Signed-off-by: Martin Renvoize Signed-off-by: Andrew Nugged Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- C4/XSLT.pm | 7 ++++++- Koha/Biblio.pm | 5 ++--- admin/searchengine/elasticsearch/mappings.yaml | 9 +++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 52c021947f..b2c3e27b61 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -296,9 +296,14 @@ sub XSLTParse4Display { if ( $biblio->components() ) { my @componentPartRecordXML = (''); for my $cb ( @{ $biblio->components() } ) { + if( ref $cb eq 'MARC::Record'){ + $cb = $cb->as_xml_record(); + } else { + $cb = decode('utf8', $cb); + } # Remove the xml header $cb =~ s/^<\?xml.*?\?>//; - push @componentPartRecordXML, decode('utf8', $cb); + push @componentPartRecordXML,$cb; } push @componentPartRecordXML, ''; $partsxml = join "\n", @componentPartRecordXML; diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 7748710b5b..50c53b69a7 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -505,12 +505,11 @@ sub components { $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()."'"; } my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, undef ); - $self->{_components} = $results if ( defined($results) && scalar(@$results) ); } else { warn "Record $self->id has no 001"; diff --git a/admin/searchengine/elasticsearch/mappings.yaml b/admin/searchengine/elasticsearch/mappings.yaml index 4170cf3e28..28429878f9 100644 --- a/admin/searchengine/elasticsearch/mappings.yaml +++ b/admin/searchengine/elasticsearch/mappings.yaml @@ -1251,6 +1251,15 @@ biblios: sort: ~ suggestible: '' type: '' + control-number-identifier: + label: control-number-identifier + mappings: + - facet: '' + marc_field: 003 + marc_type: marc21 + sort: ~ + suggestible: '' + type: '' copydate: label: copydate mappings: -- 2.39.5