@@ -, +, @@ -- type X into field Y -- click button Z -- click downdrop W -- select item V -- enter 'text' into text box labelled A authority server, Koha will now find none." --- Koha/SearchEngine/Zebra/Search.pm | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) --- a/Koha/SearchEngine/Zebra/Search.pm +++ a/Koha/SearchEngine/Zebra/Search.pm @@ -21,10 +21,14 @@ use Modern::Perl; use base qw(Class::Accessor); +# Added index accessor, because base isn't Koha::SearchEngine +# Because of nasty nested loopy dependencies that would +# break things if it was changed right now. __PACKAGE__->mk_ro_accessors(qw( index )); use C4::Search; # :( use C4::AuthoritiesMarc; +use Carp; =head1 NAME @@ -37,18 +41,25 @@ Koha::SearchEngine::Zebra::Search - Search implementation for Zebra =item index The name of the index to use, generally 'biblios' or 'authorities'. +It is provided as a parameter when this is instantiated. -=back + my $index = 'authorities'; # could be 'biblios' + my $searcher = + Koha::SearchEngine::Zebra::Search->new( { index => $index } ); -=head1 FUNCTIONS +=back =cut sub new { - my $class = shift @_; - my $self = $class->SUPER::new(@_); + my @parameters = @_; + my $class = shift @parameters; + my $self = $class->SUPER::new(@parameters); + # Check for a valid index - croak('No index name provided') unless $self->index; + if ( !defined $self->index ) { + croak('No index name provided'); + } return $self; } @@ -96,9 +107,11 @@ This passes straight through to C4::Search::SimpleSearch. sub simple_search_compat { - my $self = shift; my @parameters = @_; - if ($self->index eq 'authorities') { + my $self = shift @parameters; + + # default is ['biblioserver'], so just fix authorities. + if ( $self->index eq 'authorities' ) { push @parameters, ['authorityserver']; } return C4::Search::SimpleSearch(@parameters); --