module Jekyll::Algolia::Indexer

def self.record_count(index)

possible. It will still contain the nbHits
only return the objectID and one element, to get the shortest response
Note: We'll do an empty query search, to match everything, but we'll

index - Index to check

Public: Get the number of records in an index
def self.record_count(index)
  index.search(
    '',
    attributesToRetrieve: 'objectID',
    distinct: false,
    hitsPerPage: 1
  )['nbHits']
rescue StandardError
  0
end