All deletes should be removed after an optimize. Otherwise, I think you'll have to call isDeleted before trying to access the document. numDocs does not include deletes, but the document() call will retrieve deletes. You might try using maxDoc() instead of numDocs().
- Mark
