Bugzilla – Attachment 155614 Details for
Bug 33406
Searching for authority with hyphen surrounded by spaces causes error 500 (with ES)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33406: (QA follow-up) Adjust tests and tidy
Bug-33406-QA-follow-up-Adjust-tests-and-tidy.patch (text/plain), 3.16 KB, created by
Nick Clemens (kidclamp)
on 2023-09-14 13:25:25 UTC
(
hide
)
Description:
Bug 33406: (QA follow-up) Adjust tests and tidy
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-09-14 13:25:25 UTC
Size:
3.16 KB
patch
obsolete
>From 650109aa755029b385ee8e5e71d50a1a1b4f19d0 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 14 Sep 2023 13:21:44 +0000 >Subject: [PATCH] Bug 33406: (QA follow-up) Adjust tests and tidy > >Rather than test that nothing is returned, we want to test that the terms are filtered as expected. This also avoids the possibility of the tests failing in a db where there is a record for Donald Duck > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > authorities/authorities-home.pl | 14 ++++---------- > t/Koha/SearchEngine/Elasticsearch/Search.t | 9 +++++---- > 2 files changed, 9 insertions(+), 14 deletions(-) > >diff --git a/authorities/authorities-home.pl b/authorities/authorities-home.pl >index 84122ed0e8..467da48e77 100755 >--- a/authorities/authorities-home.pl >+++ b/authorities/authorities-home.pl >@@ -97,25 +97,19 @@ if ( $op eq "do_search" ) { > } > ); > >- my $builder = Koha::SearchEngine::QueryBuilder->new( >- { index => $Koha::SearchEngine::AUTHORITIES_INDEX } ); >- my $searcher = Koha::SearchEngine::Search->new( >- { index => $Koha::SearchEngine::AUTHORITIES_INDEX } ); >+ my $builder = Koha::SearchEngine::QueryBuilder->new( { index => $Koha::SearchEngine::AUTHORITIES_INDEX } ); >+ my $searcher = Koha::SearchEngine::Search->new( { index => $Koha::SearchEngine::AUTHORITIES_INDEX } ); > > my $search_query = $builder->build_authorities_query_compat( > [$marclist], [$and_or], [$excluding], [$operator], > [$value], $authtypecode, $orderby > ); > my ( $results, $total ); >- eval { >- ( $results, $total ) = $searcher->search_auth_compat( >- $search_query, $offset, $resultsperpage >- ); >- }; >+ eval { ( $results, $total ) = $searcher->search_auth_compat( $search_query, $offset, $resultsperpage ); }; > if ($@) { > my $query_error = q{}; > $query_error .= $@ if $@; >- $template->param(query_error => $query_error); >+ $template->param( query_error => $query_error ); > } > > $template->param( search_query => $search_query ) if C4::Context->preference('DumpSearchQueryTemplate'); >diff --git a/t/Koha/SearchEngine/Elasticsearch/Search.t b/t/Koha/SearchEngine/Elasticsearch/Search.t >index 046767cf01..6353793b10 100755 >--- a/t/Koha/SearchEngine/Elasticsearch/Search.t >+++ b/t/Koha/SearchEngine/Elasticsearch/Search.t >@@ -45,12 +45,13 @@ subtest 'search_auth_compat' => sub { > > my $search_query = $builder->build_authorities_query_compat( > ['mainmainentry'], ['and'], [''], ['contains'], >- ['Donald - Duck'], '', 'HeadingAsc' >+ ['Donald - ^ \ ~ + Duck'], '', 'HeadingAsc' > ); > >- my ( $bad_results, undef ) = $search->search_auth_compat( $search_query, 0, 20, undef ); >- >- is( @$bad_results[0], undef, 'We expect no record because it doesnt exist' ); >+ is( >+ $search_query->{query}->{bool}->{must}->[0]->{query_string}->{query}, '(Donald*) AND (Duck*)', >+ "Reserved characters -, ^, \\, ~, + have been removed from search query" >+ ); > > my $module = Test::MockModule->new('Koha::SearchEngine::Elasticsearch::Search'); > $module->mock( 'count_auth_use', sub { return 1 } ); >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33406
:
151067
|
154313
|
154314
|
155198
|
155199
|
155200
|
155611
|
155612
|
155613
| 155614 |
155818