module Jekyll::Algolia::Indexer

def self.remote_object_ids_from_main_index

a progress bar.
Note: As this will be slow (grabbing them 1000 at a time), we display

Public: Get an array of all object IDs stored in the main index
def self.remote_object_ids_from_main_index
  Logger.verbose("I:Inspecting existing records in index #{index.name}")
  list = []
  # As it might take some time, we display a progress bar
  progress_bar = ProgressBar.create(
    total: record_count(index),
    format: 'Inspecting existing records (%j%%) |%B|'
  )
  begin
    index.browse(
      attributesToRetrieve: 'objectID',
      hitsPerPage: 1000
    ) do |hit|
      list << hit['objectID']
      progress_bar.increment
    end
  rescue StandardError
    return []
  end
  list.sort
end