/// <summary>Clears the index.</summary> public virtual void Clear() { logger.Debug("Clearing index"); if (accessor.IndexExists()) { accessor.ClearLock(); var w = accessor.GetWriter(); if (w.NumDocs() > 0) { w.DeleteAll(); w.Commit(); accessor.RecreateSearcher(); } accessor.ClearLock(); } }
public virtual void Clear() { logger.Info("Clearing index"); if (accessor.IndexExists()) { accessor.ClearLock(); using (var iw = accessor.GetWriter()) { if (iw.NumDocs() > 0) { iw.DeleteAll(); iw.PrepareCommit(); iw.Commit(); accessor.RecreateSearcher(); } } accessor.ClearLock(); } }