}
if ( $thesaurus ) {
- # This is calculated in C4/Heading/MARC21.pm - not used for UNIMARC
- if ($thesaurus eq 'lcsh') {
- $subject_heading_thesaurus = 'a';
- } elsif ($thesaurus eq 'lcac') {
- $subject_heading_thesaurus = 'b';
- } elsif ($thesaurus eq 'mesh') {
- $subject_heading_thesaurus = 'c';
- } elsif ($thesaurus eq 'nal') {
- $subject_heading_thesaurus = 'd';
- } elsif ($thesaurus eq 'notspecified') {
- $subject_heading_thesaurus = 'n';
- } elsif ($thesaurus eq 'cash') {
- $subject_heading_thesaurus = 'k';
- } elsif ($thesaurus eq 'rvm') {
- $subject_heading_thesaurus = 'v';
- } else { # We stored the value from $7 as the thesaurus if there was one
- $subject_heading_thesaurus = 'z';
- push @marclist, 'thesaurus-conventions';
- push @and_or, 'and';
- push @excluding, '';
- push @operator, 'is';
- push @value, $self->{'thesaurus'};
- }
push @marclist, 'thesaurus';
push @and_or, 'and';
push @excluding, '';
push @operator, 'is';
- push @value, $subject_heading_thesaurus;
+ push @value, $thesaurus;
}
require Koha::SearchEngine::QueryBuilder;
}
}
);
- $mappings->{properties}{ 'match-heading' } = _get_elasticsearch_field_config('search', 'text') if $self->index eq 'authorities';
+ if( $self->index eq 'authorities' ){
+ $mappings->{properties}{ 'match-heading' } = _get_elasticsearch_field_config('search', 'text');
+ $mappings->{properties}{ 'subject-heading-thesaurus' } = _get_elasticsearch_field_config('search', 'text');
+ }
$all_mappings{$self->index} = $mappings;
}
$self->sort_fields(\%{$sort_fields{$self->index}});
}
}
+ if( $self->index eq 'authorities' ){
+ push @{$rules->{control_fields}->{'008'}}, ['subject-heading-thesaurus', { 'substr' => [ 11, 1 ] } ];
+ push @{$rules->{data_fields}->{'040'}->{subfields}->{f}}, ['subject-heading-thesaurus', { } ];
+ }
+
return $rules;
}
all => ''
};
+our $thesaurus_to_value = {
+ lcsh => 'a',
+ lcac => 'b',
+ mesh => 'c',
+ nal => 'd',
+ notspecified => 'n',
+ cash => 'k',
+ rvm => 'v',
+};
+
sub build_authorities_query_compat {
my ( $self, $marclist, $and_or, $excluding, $operator, $value,
$authtypecode, $orderby )
}
for ( my $i = 0 ; $i < @$value ; $i++ ) {
next unless $value->[$i]; #clean empty form values, ES doesn't like undefined searches
+ $value->[$i] = $thesaurus_to_value->{ $value->[$i] }
+ if( defined $thesaurus_to_value->{ $value->[$i] } && $indexes[$i] eq 'subject-heading-thesaurus' );
push @searches,
{
where => $indexes[$i],
sort: ~
suggestible: ''
type: ''
- Subject-heading-thesaurus:
- label: Subject-heading-thesaurus
- mappings:
- - facet: ''
- marc_field: 008_/11
- marc_type: marc21
- sort: ~
- suggestible: ''
- type: ''
- Subject-heading-thesaurus-conventions:
- label: Subject-heading-thesaurus-conventions
- mappings:
- - facet: ''
- marc_field: 040f
- marc_type: marc21
- sort: ~
- suggestible: ''
- type: ''
authtype:
label: authtype
mappings:
$terms = $search_query->{query}->{bool}->{must};
$expected_terms = [
{ term => { 'match-heading.ci_raw' => 'Uncles generalsubdiv Fiction' } },
- { term => { 'subject-heading-thesaurus-conventions.ci_raw' => 'special_sauce' } },
- { term => { 'subject-heading-thesaurus.ci_raw' => 'z' } },
+ { term => { 'subject-heading-thesaurus.ci_raw' => 'special_sauce' } },
];
is_deeply( $terms, $expected_terms, "Search formed as expected with second indicator 7 and subfield 2");