tags:

views:

45

answers:

2

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?

+1  A: 

now the deletions can be done with IndexWriter

http://lucene.apache.org/java/3_0_2/api/all/org/apache/lucene/index/IndexWriter.html

keshav.veerapaneni
i need to be able to delete by the docid however. i have a large index, and rebuilding the index with uniqueness is not a possibility as it is over 100gb. several indexes were merged together giving duplicate entries, and i need to find a way to get rid of the ones that are duplicates. I found code to do it with the index readers .delete() method, but now that its gone, I am having a very difficult time finding a way to do this.
recursive9
+1  A: 

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"));

Xodarap