From 43dff988bd480c27e6e2d1aee33811ce06e93f0a Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 1 Sep 2021 16:16:33 +0100 Subject: [PATCH] Bug 11175: (follow-up) Use clean_search_term This patch uses the now public clean_search_term from bug 28316 to sanitize the title string and prevent crashes in elastic search when title contain reserved characters. Signed-off-by: Martin Renvoize Signed-off-by: Andrew Nugged Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- Koha/Biblio.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index d32a9eff7c..5026ec7783 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -43,6 +43,7 @@ use Koha::Suggestions; use Koha::Subscriptions; use Koha::SearchEngine; use Koha::SearchEngine::Search; +use Koha::SearchEngine::QueryBuilder; =head1 NAME @@ -512,6 +513,8 @@ Returns a query which can be used to search for all component parts of MARC21 bi sub get_components_query { my ($self) = @_; + my $builder = Koha::SearchEngine::QueryBuilder->new( + { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); my $marc = $self->metadata->record; my $searchstr; @@ -542,6 +545,7 @@ sub get_components_query { else { my $cleaned_title = $marc->title; $cleaned_title =~ tr|/||; + $cleaned_title = $builder->clean_search_term($cleaned_title); $searchstr = "Host-item:($cleaned_title)"; } -- 2.39.5