@@ -, +, @@ QueryParser is enabled uses 'Heading A-Z' as the sort order and returns hits. No hits are returned. --- C4/AuthoritiesMarc.pm | 2 +- t/db_dependent/Search.t | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) --- a/C4/AuthoritiesMarc.pm +++ a/C4/AuthoritiesMarc.pm @@ -221,7 +221,7 @@ sub SearchAuthorities { $qpquery = $1; } - $qpquery .= " #$sortby"; + $qpquery .= " #$sortby" unless $sortby eq ''; $QParser->parse( $qpquery ); $query = $QParser->target_syntax('authorityserver'); --- a/t/db_dependent/Search.t +++ a/t/db_dependent/Search.t @@ -12,7 +12,7 @@ use YAML; use C4::Debug; require C4::Context; -use Test::More tests => 216; +use Test::More tests => 224; use Test::MockModule; use MARC::Record; use File::Spec; @@ -737,6 +737,16 @@ sub run_marc21_search_tests { ); is($count, 1, 'MARC21 authorities: one hit on mainentry starts with "shakespeare"'); ($auths, $count) = SearchAuthorities( + ['mainentry'], ['and'], [''], ['starts'], + ['shakespeare'], 0, 10, '', 'HeadingAsc', 1 + ); + is($count, 1, 'MARC21 authorities: one hit on mainentry starts with "shakespeare" sorted by heading ascending'); + ($auths, $count) = SearchAuthorities( + ['mainentry'], ['and'], [''], ['starts'], + ['shakespeare'], 0, 10, '', 'HeadingDsc', 1 + ); + is($count, 1, 'MARC21 authorities: one hit on mainentry starts with "shakespeare" sorted by heading descending'); + ($auths, $count) = SearchAuthorities( ['match'], ['and'], [''], ['contains'], ['沙士北亞威廉姆'], 0, 10, '', '', 1 ); @@ -750,6 +760,16 @@ sub run_marc21_search_tests { ); is($count, 1, 'MARC21 authorities: one hit on mainentry starts with "shakespeare" (QP)'); ($auths, $count) = SearchAuthorities( + ['mainentry'], ['and'], [''], ['starts'], + ['shakespeare'], 0, 10, '', 'HeadingAsc', 1 + ); + is($count, 1, 'MARC21 authorities: one hit on mainentry starts with "shakespeare" sorted by heading ascending (QP)'); + ($auths, $count) = SearchAuthorities( + ['mainentry'], ['and'], [''], ['starts'], + ['shakespeare'], 0, 10, '', 'HeadingDsc', 1 + ); + is($count, 1, 'MARC21 authorities: one hit on mainentry starts with "shakespeare" sorted by heading descending (QP)'); + ($auths, $count) = SearchAuthorities( ['match'], ['and'], [''], ['contains'], ['沙士北亞威廉姆'], 0, 10, '', '', 1 ); --