Koha::ElasticSearch::Indexer - handles adding new records to the index
my $indexer = Koha::ElasticSearch::Indexer->new(
{ index => Koha::SearchEngine::BIBLIOS_INDEX } );
$indexer->drop_index();
$indexer->update_index(\@biblionumbers, \@records);
$biblionums is an arrayref containing the biblionumbers for the records.
$records is an arrayref containing the MARC::Records themselves.
The values in the arrays must match up, and the 999$c value in the MARC record will be rewritten using the values in $biblionums to ensure they are correct. If $biblionums is undef, this won't happen, but you should be sure that 999$c is correct on your own then.
Note that this will modify the original record if $biblionums is supplied. If that's a problem, clone them first.
This has exactly the same API as update_index_background however it'll return immediately. It'll start a background process that does the adding.
If it fails to add to Elasticsearch then it'll add to a queue that will cause it to be updated by a regular index cron job in the future.
# TODO implement in the future - I don't know the best way of doing this yet. # If fork: make sure process group is changed so apache doesn't wait for us.
$biblionums is an arrayref of biblionumbers to delete from the index.
Identical to delete_index, this will return immediately and start a background process to do the actual deleting.
Drops the index from the elasticsearch server. Calling update_index after this will recreate it again.
<chrisc@catalyst.net.nz><robin@catalyst.net.nz>