Method DeleteAll
DeleteAll()
Delete all documents in the index.
This method will drop all buffered documents and will remove all segments from the index. This change will not be visible until a Commit() has been called. This method can be rolled back using Rollback().
NOTE: this method is much faster than using DeleteDocuments(new MatchAllDocsQuery())
.
Yet, this method also has different semantics compared to DeleteDocuments(Query)
/ DeleteDocuments(Query[]) since internal data-structures are cleared as well
as all segment information is forcefully dropped anti-viral semantics like omitting norms
are reset or doc value types are cleared. Essentially a call to DeleteAll() is equivalent
to creating a new IndexWriter with CREATE which a delete query only marks
documents as deleted.
NOTE: this method will forcefully abort all merges in progress. If other threads are running ForceMerge(Int32), AddIndexes(IndexReader[]) or ForceMergeDeletes() methods, they may receive MergePolicy.MergeAbortedExceptions.
Declaration
public virtual void DeleteAll()