Lines 21-30
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. |
24 |
__PACKAGE__->mk_ro_accessors(qw( index )); |
27 |
__PACKAGE__->mk_ro_accessors(qw( index )); |
25 |
|
28 |
|
26 |
use C4::Search; # :( |
29 |
use C4::Search; # :( |
27 |
use C4::AuthoritiesMarc; |
30 |
use C4::AuthoritiesMarc; |
|
|
31 |
use Carp; |
28 |
|
32 |
|
29 |
=head1 NAME |
33 |
=head1 NAME |
30 |
|
34 |
|
Lines 37-54
Koha::SearchEngine::Zebra::Search - Search implementation for Zebra
Link Here
|
37 |
=item index |
41 |
=item index |
38 |
|
42 |
|
39 |
The name of the index to use, generally 'biblios' or 'authorities'. |
43 |
The name of the index to use, generally 'biblios' or 'authorities'. |
|
|
44 |
It is provided as a parameter when this is instantiated. |
40 |
|
45 |
|
41 |
=back |
46 |
my $index = 'authorities'; # could be 'biblios' |
|
|
47 |
my $searcher = |
48 |
Koha::SearchEngine::Zebra::Search->new( { index => $index } ); |
42 |
|
49 |
|
43 |
=head1 FUNCTIONS |
50 |
=back |
44 |
|
51 |
|
45 |
=cut |
52 |
=cut |
46 |
|
53 |
|
47 |
sub new { |
54 |
sub new { |
48 |
my $class = shift @_; |
55 |
my @parameters = @_; |
49 |
my $self = $class->SUPER::new(@_); |
56 |
my $class = shift @parameters; |
|
|
57 |
my $self = $class->SUPER::new(@parameters); |
58 |
|
50 |
# Check for a valid index |
59 |
# Check for a valid index |
51 |
croak('No index name provided') unless $self->index; |
60 |
if ( !defined $self->index ) { |
|
|
61 |
croak('No index name provided'); |
62 |
} |
52 |
return $self; |
63 |
return $self; |
53 |
} |
64 |
} |
54 |
|
65 |
|
Lines 96-104
This passes straight through to C4::Search::SimpleSearch.
Link Here
|
96 |
|
107 |
|
97 |
|
108 |
|
98 |
sub simple_search_compat { |
109 |
sub simple_search_compat { |
99 |
my $self = shift; |
|
|
100 |
my @parameters = @_; |
110 |
my @parameters = @_; |
101 |
if ($self->index eq 'authorities') { |
111 |
my $self = shift @parameters; |
|
|
112 |
|
113 |
# default is ['biblioserver'], so just fix authorities. |
114 |
if ( $self->index eq 'authorities' ) { |
102 |
push @parameters, ['authorityserver']; |
115 |
push @parameters, ['authorityserver']; |
103 |
} |
116 |
} |
104 |
return C4::Search::SimpleSearch(@parameters); |
117 |
return C4::Search::SimpleSearch(@parameters); |
105 |
- |
|
|