1
votes

When doing research on deleting documents in lucene I have been shown to use the IndexReaders delete() method, passing in the document id. Now that I actually need to do this, it appears that lucene currently does not support this method, and I have had very little luck in finding the current way to do this.

Any ideas?

2

2 Answers

1
votes

Doc IDs are internal to Lucene, and really should never be used. They are liable to change without warning, among other issues.

How are you getting the doc IDs? Presumably through a query? Then just delete based on that query. Alternatively, if you have your own unique ID field, you can do writer.DeleteDocuments(new Term("MyIDField", "ID to delete"));