|
Lines 21-33
use Modern::Perl;
Link Here
|
| 21 |
|
21 |
|
| 22 |
use base qw(Class::Accessor); |
22 |
use base qw(Class::Accessor); |
| 23 |
|
23 |
|
|
|
24 |
# Added index accessor, because base isn't Koha::SearchEngine |
| 25 |
# Because of nasty nested loopy dependencies that would |
| 26 |
# break things if it was changed right now. |
| 27 |
__PACKAGE__->mk_ro_accessors(qw( index )); |
| 28 |
|
| 24 |
use C4::Search; # :( |
29 |
use C4::Search; # :( |
| 25 |
use C4::AuthoritiesMarc; |
30 |
use C4::AuthoritiesMarc; |
|
|
31 |
use Carp; |
| 26 |
|
32 |
|
| 27 |
=head1 NAME |
33 |
=head1 NAME |
| 28 |
|
34 |
|
| 29 |
Koha::SearchEngine::Zebra::Search - Search implementation for Zebra |
35 |
Koha::SearchEngine::Zebra::Search - Search implementation for Zebra |
| 30 |
|
36 |
|
|
|
37 |
=head1 ACCESSORS |
| 38 |
|
| 39 |
=over 4 |
| 40 |
|
| 41 |
=item index |
| 42 |
|
| 43 |
The name of the index to use, generally 'biblios' or 'authorities'. |
| 44 |
It is provided as a parameter when this is instantiated. |
| 45 |
|
| 46 |
my $index = 'authorities'; # could be 'biblios' |
| 47 |
my $searcher = |
| 48 |
Koha::SearchEngine::Zebra::Search->new( { index => $index } ); |
| 49 |
|
| 50 |
=back |
| 51 |
|
| 52 |
=cut |
| 53 |
|
| 54 |
sub new { |
| 55 |
my @parameters = @_; |
| 56 |
my $class = shift @parameters; |
| 57 |
my $self = $class->SUPER::new(@parameters); |
| 58 |
|
| 59 |
# Check for a valid index |
| 60 |
if ( !defined $self->index ) { |
| 61 |
croak('No index name provided'); |
| 62 |
} |
| 63 |
return $self; |
| 64 |
} |
| 65 |
|
| 31 |
=head1 METHODS |
66 |
=head1 METHODS |
| 32 |
|
67 |
|
| 33 |
=head2 search |
68 |
=head2 search |
|
Lines 72-79
This passes straight through to C4::Search::SimpleSearch.
Link Here
|
| 72 |
|
107 |
|
| 73 |
|
108 |
|
| 74 |
sub simple_search_compat { |
109 |
sub simple_search_compat { |
| 75 |
shift; |
110 |
my @parameters = @_; |
| 76 |
return C4::Search::SimpleSearch(@_); |
111 |
my $self = shift @parameters; |
|
|
112 |
|
| 113 |
# default is ['biblioserver'], so just fix authorities. |
| 114 |
if ( $self->index eq 'authorities' ) { |
| 115 |
push @parameters, ['authorityserver']; |
| 116 |
} |
| 117 |
return C4::Search::SimpleSearch(@parameters); |
| 77 |
} |
118 |
} |
| 78 |
|
119 |
|
| 79 |
=head2 search_auth_compat |
120 |
=head2 search_auth_compat |
| 80 |
- |
|
|