Bug 33277: Search thesaurus for 'notspecified'

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 7911eb6666)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2023-03-21 19:34:50 +00:00 committed by Matt Blenkinsop
parent 316ff0c504
commit fcee8f8a7d
3 changed files with 16 additions and 4 deletions

View file

@ -573,11 +573,13 @@ our $thesaurus_to_value = {
lcac => 'b',
mesh => 'c',
nal => 'd',
notspecified => 'n',
notapplicable => 'n',
cash => 'k',
rvm => 'v',
aat => 'r',
sears => 's'
sears => 's',
notdefined => 'z',
notspecified => '|'
};
sub build_authorities_query_compat {

View file

@ -2452,7 +2452,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
</xslo:choose>
</xslo:when>
<xslo:otherwise>
<xslo:text>notdefined</xslo:text>
<xslo:text>notspecified</xslo:text>
</xslo:otherwise>
</xslo:choose>
</xslo:variable>

View file

@ -65,7 +65,7 @@ subtest "UNIMARC tests" => sub {
subtest "_search tests" => sub {
plan tests => 7;
plan tests => 8;
t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
t::lib::Mocks::mock_preference('SearchEngine', 'Elasticsearch');
@ -111,6 +111,16 @@ subtest "_search tests" => sub {
];
is_deeply( $terms, $expected_terms, "Search formed as expected with second indicator 7 and subfield 2");
$field = MARC::Field->new( '650', ' ', '4', a => 'Uncles', x => 'Fiction' );
$heading = C4::Heading->new_from_field($field);
($search_query) = $heading->_search( 'match-heading' );
$terms = $search_query->{query}->{bool}->{must};
$expected_terms = [
{ term => { 'match-heading.ci_raw' => 'Uncles generalsubdiv Fiction' } },
{ term => { 'subject-heading-thesaurus.ci_raw' => '|' } },
];
is_deeply( $terms, $expected_terms, "Search looks for thesaurus '|' when second indicator 4");
$field = MARC::Field->new( '100', ' ', '', a => 'Yankovic, Al', d => '1959-,' );
$heading = C4::Heading->new_from_field($field);
($search_query) = $heading->_search( 'match-heading' );