module Jekyll::Algolia::Indexer

def self.remote_object_ids(index)

processed, but makes debugging easier when comparing arrays is needed.
The returned array is sorted. It won't have any impact on the way it is

index - Algolia Index to target

Public: Returns an array of all the objectIDs in the index
def self.remote_object_ids(index)
  list = []
  Logger.verbose(
    "I:Inspecting existing records in index #{index.name}..."
  )
  begin
    index.browse(attributesToRetrieve: 'objectID') do |hit|
      list << hit['objectID']
    end
  rescue StandardError
    # The index might not exist if it's the first time we use the plugin
    # so we'll consider that it means there are no records there
    return []
  end
  list.sort
end