module Jekyll::Algolia::Indexer

def self.update_records(index, records)

Does nothing in dry run mode

content will change its objectID as well.
should be updated but this case should never happen as changing a record
New records will be automatically added. Technically existing records

records - Array of records to update
index - Algolia Index to update

Public: Update records of the specified index
def self.update_records(index, records)
  batch_size = Configurator.algolia('indexing_batch_size')
  records.each_slice(batch_size) do |batch|
    Logger.log("I:Pushing #{batch.size} records")
    next if Configurator.dry_run?
    begin
      index.add_objects!(batch)
    rescue StandardError => error
      ErrorHandler.stop(error, records: records)
    end
  end
end