def index_documents()

in ees_network_drive/sync_enterprise_search.py [0:0]


    def index_documents(self, documents):
        """This method indexes the documents to the Enterprise Search.
        :param documents: list of documents to be indexed
        """
        self.total_documents_found += len(documents)
        if documents:
            documents_indexed = 0
            responses = self.workplace_search_custom_client.index_documents(
                documents,
                CONNECTION_TIMEOUT,
            )
            for document in responses["results"]:
                if not document["errors"]:
                    documents_indexed += 1
                else:
                    self.logger.error(
                        f"Unable to index the document with id: {document['id']} Error {document['errors']}"
                    )
            self.total_document_indexed += documents_indexed