I want to delete all the previously created indices. I am using Lucene.net
.
I tried the following:
Term term = new Term(); //empty because I want to delete all the indices
IndexReader rdr = IndexReader.Open(_directory);
rdr.DeleteDocuments(term);
rdr.Close();
But I get error. Any idea how to go about it?
The best way to delete an index is to wipe the filesystem directory. However, if you wan't to regenerate the index, the easiest way is to open a new indexwriter with the create parameter as true. It will start a new index deleting the contents of the existing one.