module Jekyll::Algolia::Indexer
def self.run(records)
Public: Push all records to Algolia and configure the index
def self.run(records) init # Indexing zero record is surely a misconfiguration if records.length.zero? files_to_exclude = Configurator.algolia('files_to_exclude').join(', ') Logger.known_message( 'no_records_found', 'files_to_exclude' => files_to_exclude, 'nodes_to_index' => Configurator.algolia('nodes_to_index') ) exit 1 end index_name = Configurator.index_name index = index(index_name) # Update settings update_settings(index) # Getting list of objectID in remote and locally remote_ids = remote_object_ids(index) local_ids = local_object_ids(records) # Getting list of what to add and what to delete old_records_ids = remote_ids - local_ids new_records_ids = local_ids - remote_ids new_records = records.select do |record| new_records_ids.include?(record[:objectID]) end update_records(index_name, old_records_ids, new_records) Logger.log('I:✔ Indexing complete') end