java - Delete lucene index and re-index -


i'm creating lucene index using ramdirectory, , allowing searches performed using index. have functionality re-index when text updated. problem is, if text changes, old index not cleared/deleted.

i've tried using close(); directory prevents being accessed in future (afaik).

how can delete old index before re-indexing?

calling indexwriter.update(doc) delete-add process.

according documentation:

updates document first deleting document(s) containing term , adding new document. delete , add atomic seen reader on same index (flush may happen after add).


Comments