1 package Koha::SearchEngine::Zebra::Indexer;
3 # Copyright 2020 ByWater Solutions
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
21 use C4::Biblio qw( ModZebra ); # FIXME This is terrible, we should move the indexation code outside of C4::Biblio
22 use base qw(Class::Accessor);
26 Koha::SearchEngine::Elasticsearch::Indexer - handles adding new records to the index
30 my $indexer = Koha::SearchEngine::Zebra::Indexer->new();
31 $indexer->index_records( $record_numbers, $op, $server, $records);
38 This is a dummy function to create the object. C4::Biblio->ModZebra is doing the real work
39 now and needed variables are passed to index_records
45 my $self = $class->SUPER::new(@_);
48 =head2 index_records($record_numbers, $op, $server, $records)
50 This is simply a wrapper to C4::Biblio::ModZebra that takes an array of records and
51 passes them through individually
53 The final parameter $records is not used in Zebra, it exists for parity with Elasticsearch calls
58 my ( $self, $record_numbers, $op, $server, $records ) = @_;
59 $record_numbers = [$record_numbers] if ref $record_numbers ne 'ARRAY' && defined $record_numbers;
60 foreach my $record_number ( @$record_numbers ){
61 ModZebra( $record_number, $op, $server );