def add_doc(self, doc, index_update=True, label_guesser_update=True):
        """
        Add a document to the index
        """
        if not self.index_writer and index_update:
            self.index_writer = self.index.writer()
        if not self.label_guesser_updater and label_guesser_update:
            self.label_guesser_updater = self.label_guesser.get_updater()
        logger.info("Indexing new doc: %s" % doc)
        if index_update:
            self._update_doc_in_index(self.index_writer, doc)
        if label_guesser_update:
            self.label_guesser_updater.add_doc(doc)
        if doc.docid not in self._docs_by_id:
            self._docs_by_id[doc.docid] = doc