Friday, August 26, 2005

Hit by Lucene Hits

java.io.IOException: Bad file descriptor
 	at java.io.RandomAccessFile.seek(Native Method)
 	at org.apache.lucene.store.FSInputStream.readInternal(FSDirectory.java:415)
 	at org.apache.lucene.store.InputStream.refill(InputStream.java:158)
 	at org.apache.lucene.store.InputStream.readByte(InputStream.java:43)
 	at org.apache.lucene.store.InputStream.readBytes(InputStream.java:57)
 	at org.apache.lucene.index.CompoundFileReader$CSInputStream.readInternal(CompoundFileReader.java:220)
 	at org.apache.lucene.store.InputStream.refill(InputStream.java:158)
 	at org.apache.lucene.store.InputStream.readByte(InputStream.java:43)
 	at org.apache.lucene.store.InputStream.readInt(InputStream.java:73)
 	at org.apache.lucene.store.InputStream.readLong(InputStream.java:96)
 	at org.apache.lucene.index.FieldsReader.doc(FieldsReader.java:59)
 	at org.apache.lucene.index.SegmentReader.document(SegmentReader.java:237)
 	at org.apache.lucene.search.IndexSearcher.doc(IndexSearcher.java:74)
 	at org.apache.lucene.search.Hits.doc(Hits.java:101)

The Hits should only be accessed when its corresponding IndexSearcher is open. Attempting to access the Hits after the searcher is closed may result in above exception.

The most disturbing thing is that this is not mentioned in the Lucene Javadoc, nor in the "Lucene In Action" book. Thus guarantee any newcomer will be hit by the hits issue! (pun intended)

Technorati Tags: ,

5 comments:

Enrico said...

thanks a lot!
after 2 hours of unsuccesful attempts to understand what did this error mean, I found your post.

You saved my day!

Anonymous said...

Ooh, thank you so much!

I was stuck on this one too.

Dragan said...

Tank you, this is exactly what hit me.

scoheb said...

This helped me too!

Thanks!

jimmarq said...

You saved my sanity. I had a similar error using Lucene.NET. Your post pointed me in the right direction.