docs: def index_objects(self, objects, index="default"):
          """Bulk index a list of objects."""
          if not objects:
              return
  
          index_name = index
          index = self.app_state.indexes[index_name]
          indexed = set()
  
          with index.writer() as writer:
              for obj in objects:
                  document = self.get_document(obj)
                  if document is None:
                      continue
  
                  object_key = document["object_key"]
                  if object_key in indexed:
                      continue
  
                  writer.delete_by_term("object_key", object_key)
                  try:
                      writer.add_document(**document)
                  except ValueError:
                      # logger is here to give us more infos in order to catch a weird bug
                      # that happens regularly on CI but is not reliably
                      # reproductible.
                      logger.error("writer.add_document(%r)", document, exc_info=True)
                      raise
                  indexed.add(object_key)