lucene delete record, deprecated?
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.
An开发者_如何学Pythony ideas?
now the deletions can be done with IndexWriter
http://lucene.apache.org/java/3_0_2/api/all/org/apache/lucene/index/IndexWriter.html
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"));
精彩评论