This may not be very elegant, but if you are really in a jam, here is what I would try:
Check out a copy of Lucene. Modify the isDeleted method on both MultiReader and SegmentReader so that it returns true if the docid passed in is the id in question (if it is not the id, then just have the method do what it would). This will keep Lucene from looking in the deleted bitvector and causing an arrayoutbounds exception...instead it will just return that the bad id has been removed. Then run a full optimize. When the new segments are created, your bad doc should be ignored and not make it into the new generation. Kind of a pain, but if you really cannot reindex... - Mark On 7/25/07, Rafael Rossini <[EMAIL PROTECTED]> wrote:
Hi guys, Is there a way of deleting a document that, because of some corruption, got and docID larger than the maxDoc() ? I´m trying to do this but I get this Exception: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 106577 at org.apache.lucene.util.BitVector.set(BitVector.java:53) at org.apache.lucene.index.SegmentReader.doDelete (SegmentReader.java :301) at org.apache.lucene.index.IndexReader.deleteDocument(IndexReader.java :674) at org.apache.lucene.index.MultiReader.doDelete(MultiReader.java:125) at org.apache.lucene.index.IndexReader.deleteDocument (IndexReader.java :674) at teste.DeleteError.main(DeleteError.java:9) Thanks