# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
-# I don't think this ever worked right
-#use Moose::Role;
-#with 'Koha::SearchEngine::SearchRole';
+use Modern::Perl;
use base qw(Class::Accessor);
use C4::Search; # :(
use C4::AuthoritiesMarc;
+use Koha::SearchEngine::Search;
+
+=head1 NAME
+
+Koha::SearchEngine::Zebra::Search - Search implementation for Zebra
+
+=head1 METHODS
+
+=head2 search
+
+=cut
sub search {
my ($self,$query_string) = @_;
query => $query_string,
);
- warn "search for $query_string";
-
my $results = $self->searchengine->search($query);
foreach my $item (@{ $results->items }) {
my $title = $item->get_value('ste_title');
#utf8::encode($title);
print "$title\n";
- warn dump $title;
}
}
return C4::Search::SimpleSearch(@_);
}
-=head search_auth_compat
+=head2 extract_biblionumber
+
+ my $biblionumber = $searcher->extract_biblionumber( $searchresult );
+
+$searchresult comes from simple_search_compat.
+
+Returns the biblionumber from the search result record.
+
+=cut
+
+sub extract_biblionumber {
+ my ( $self, $searchresultrecord ) = @_;
+ my $record = C4::Search::new_record_from_zebra( 'biblioserver', $searchresultrecord );
+ return Koha::SearchEngine::Search::extract_biblionumber( $record );
+}
+
+=head2 search_auth_compat
This passes the search query on to C4::AuthoritiesMarc::SearchAuthorities
=cut
sub search_auth_compat {
- my ( $self, $q, $startfrom, $resperpage ) = @_;
+ my ( $self, $q, $startfrom, $resperpage, $skipmetadata ) = @_;
my @params = (
- @{$q}{ marclist, and_or, excluding, operator, value },
+ @{$q}{ 'marclist', 'and_or', 'excluding', 'operator', 'value' },
$startfrom - 1,
- $resperpage, @{$q}{ authtypecode, orderby }
+ $resperpage, @{$q}{ 'authtypecode', 'orderby' }, $skipmetadata
);
C4::AuthoritiesMarc::SearchAuthorities(@params);
}
+=head2 max_result_window
+
+Returns the maximum number of results that can be fetched
+
+Zebra does not have such a limit, so it always returns undef
+
+=cut
+
+sub max_result_window { undef }
+
1;