You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Peter Kim <pk...@cymfony.com> on 2005/10/07 01:08:08 UTC
IllegalArgumentException: attempt to access a deleted document
Hi,
I'm getting this error from trying to access a document in my custom hit
collector:
java.lang.IllegalArgumentException: attempt to access a deleted document
at
org.apache.lucene.index.SegmentReader.document(SegmentReader.java:235
)
at
org.apache.lucene.index.MultiReader.document(MultiReader.java:108)
at
org.apache.lucene.search.IndexSearcher.doc(IndexSearcher.java:74)
at
org.apache.lucene.search.MultiSearcher.doc(MultiSearcher.java:66)
Does anyone know why I'm getting this error? Shouldn't the ids passed to
HitCollector.collect(int id, float score) all be valid? Or are deleted
ids not ignored?
I noticed one way to get around this is to use IndexReader.isDeleted()
to check if it's deleted or not. The problem with that is I only have
access to a MultiSearcher in my HitCollector which doesn't give me
access to the underlying IndexReader. I don't want to have to open an
IndexReader in my custom hit collector to use its isDeleted() method.
Anyone know any workarounds?
Thanks!
peter
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: IllegalArgumentException: attempt to access a deleted document
Posted by Doug Cutting <cu...@apache.org>.
Peter Kim wrote:
> I noticed one way to get around this is to use IndexReader.isDeleted()
> to check if it's deleted or not. The problem with that is I only have
> access to a MultiSearcher in my HitCollector which doesn't give me
> access to the underlying IndexReader. I don't want to have to open an
> IndexReader in my custom hit collector to use its isDeleted() method.
Check out the MultiSearcher methods subSearcher() and subDoc(). If you
keep an array of the IndexReaders that your MultiSearcher searches, then
you can use:
readers[searcher.subSearcher(doc)].isDeleted(searcher.subDoc(doc))
Hope that helps.
Doug
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org