1 # Copyright 2015 Catalyst IT
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20 use Test::More tests => 5;
24 use_ok('Koha::SearchEngine::Elasticsearch::Indexer');
28 $indexer = Koha::SearchEngine::Elasticsearch::Indexer->new({ 'index' => 'biblio' }),
29 'Creating new indexer object'
32 my $marc_record = MARC::Record->new();
33 $marc_record->append_fields(
34 MARC::Field->new( '001', '1234567' ),
35 MARC::Field->new( '020', '', '', 'a' => '1234567890123' ),
36 MARC::Field->new( '245', '', '', 'a' => 'Title' )
39 my $records = [$marc_record];
40 ok( my $converted = $indexer->_convert_marc_to_json($records),
41 'Convert some records' );
43 is( $converted->count, 1, 'One converted record' );
47 eval { $indexer->get_elasticsearch_params; };
49 skip 'ElasticSeatch configuration not available', 1
52 ok( $indexer->update_index(undef,$records), 'Update Index' );