def _commit_toc(self, segments): from whoosh.index import TOC, clean_files # Write a new TOC with the new segment list (and delete old files) toc = TOC(self.schema, segments, self.generation) toc.write(self.storage, self.indexname) # Delete leftover files clean_files(self.storage, self.indexname, self.generation, segments)
def create_index(self, schema, indexname=_DEF_INDEX_NAME): if self.readonly: raise ReadOnlyError TOC.create(self, schema, indexname) return FileIndex(self, schema, indexname)