From bdd7394c917e3f6b1914416fc17ddd8b0e173433 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 2 Feb 2015 16:19:02 +0100 Subject: [PATCH] Bug 12478: fix some compilation errors syntax error at /home/koha/src/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm line 341, near "confess "Invalid marclist field provided: $m" Global symbol "$sort_order" requires explicit package name at /home/koha/src/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm line 360. Can't locate object method "new" via package "Koha::ElasticSearch::Search" (perhaps you forgot to load "Koha::ElasticSearch::Search"?) at /home/koha/src/opac/opac-search.pl line 54. Can't locate object method "new" via package "Koha::SearchEngine::Elasticsearch::Search" (perhaps you forgot to load "Koha::SearchEngine::Elasticsearch::Search"?) at /home/koha/src/opac/opac-search.pl line 54. --- Koha/Biblio.pm | 2 +- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 5 +++-- Koha/SearchEngine/Elasticsearch/Search.pm | 2 +- opac/opac-search.pl | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 480b716..a044dea 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -112,7 +112,7 @@ sub get_all_biblios_iterator { my $database = Koha::Database->new(); my $schema = $database->schema(); my $rs = - $schema->resultset('Biblioitem')->search( { marc => { '!=', undef } }, + $schema->resultset('Biblioitem')->search( { marc => { '!=', undef }, biblionumber => {'=', 3} }, { columns => [qw/ biblionumber marc /] } ); my $next_func = sub { my $row = $rs->next(); diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 06780f8..d451f29 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -40,6 +40,7 @@ provides something that can be given to elasticsearch to get answers. =cut use base qw(Class::Accessor); +use Carp qw( confess ); use List::MoreUtils qw/ each_array /; use Modern::Perl; use URI::Escape; @@ -356,10 +357,10 @@ sub build_authorities_query_compat { : ( $orderby =~ /^Auth/ ) ? 'Local-Number' : undef; if ($sort_field) { - $sort_order = ( $orderby =~ /Asc$/ ) ? 'asc' : 'desc'; + my $sort_order = ( $orderby =~ /Asc$/ ) ? 'asc' : 'desc'; %sort = ( $orderby => $sort_order, ); } - %search = ( + my %search = ( searches => \@searches, authtypecode => $authtypecode, ); diff --git a/Koha/SearchEngine/Elasticsearch/Search.pm b/Koha/SearchEngine/Elasticsearch/Search.pm index 57a03f1..215404b 100644 --- a/Koha/SearchEngine/Elasticsearch/Search.pm +++ b/Koha/SearchEngine/Elasticsearch/Search.pm @@ -1,4 +1,4 @@ -package Koha::SearchEngine::ElasticSearch::Search; +package Koha::SearchEngine::Elasticsearch::Search; # Copyright 2014 Catalyst IT # diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 0fd3e9a..bd45e55 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -32,7 +32,7 @@ use List::MoreUtils q/any/; use Data::Dumper; # TODO remove -use Koha::ElasticSearch::Search; +use Koha::SearchEngine::Elasticsearch::Search; use Koha::SearchEngine::QueryBuilder; use Koha::SearchEngine::Zebra::Search; @@ -51,7 +51,7 @@ for ( $searchengine ) { } when (/^Elasticsearch$/) { # TODO refactor Koha::ES::Search into Koha::SE::ES::Search - $searcher=Koha::ElasticSearch::Search->new({index => 'biblios'}); + $searcher=Koha::SearchEngine::Elasticsearch::Search->new({index => 'biblios'}); } } -- 2.1.0