def index_documents()

in ees_sharepoint/sync_enterprise_search.py [0:0]


    def index_documents(self, documents):
        """This method indexes the documents to the Enterprise Search.
        :param documents: documents to be indexed
        """
        total_documents_indexed = 0
        if documents:
            responses = self.workplace_search_custom_client.index_documents(
                documents=documents,
                timeout=CONNECTION_TIMEOUT,
            )
            for response in responses["results"]:
                if not response["errors"]:
                    total_documents_indexed += 1
                else:
                    self.logger.error(
                        "Error while indexing %s. Error: %s"
                        % (response["id"], response["errors"])
                    )
            self.logger.info(
                f"[{threading.get_ident()}] Successfully indexed {total_documents_indexed} documents to the workplace"
            )