@@ -, +, @@ --- C4/XSLT.pm | 7 ++++++- Koha/Biblio.pm | 5 ++--- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 1 + admin/searchengine/elasticsearch/mappings.yaml | 9 +++++++++ 4 files changed, 18 insertions(+), 4 deletions(-) --- a/C4/XSLT.pm +++ a/C4/XSLT.pm @@ -283,9 +283,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; --- a/Koha/Biblio.pm +++ a/Koha/Biblio.pm @@ -526,12 +526,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"; --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -82,6 +82,7 @@ our %index_field_convert = ( 'nt' => 'note', 'notes' => 'note', 'rcn' => 'record-control-number', + 'cni' => 'control-number-identifier', 'su' => 'subject', 'su-to' => 'subject', #'su-geo' => 'subject', --- a/admin/searchengine/elasticsearch/mappings.yaml +++ a/admin/searchengine/elasticsearch/mappings.yaml @@ -1621,6 +1621,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: --