Hi,

Following Mike's advice, the actual (non-masked exception using
Directory constructor) was as following:

Exception in thread "main" java.io.IOException: read past EOF
        at 
org.apache.lucene.store.BufferedIndexInput.refill(BufferedIndexInput.java:151)
        at 
org.apache.lucene.store.BufferedIndexInput.readByte(BufferedIndexInput.java:38)
        at org.apache.lucene.store.IndexInput.readInt(IndexInput.java:68)
        at org.apache.lucene.index.FieldsReader.<init>(FieldsReader.java:84)
        at 
org.apache.lucene.index.SegmentReader.initialize(SegmentReader.java:357)
        at org.apache.lucene.index.SegmentReader.get(SegmentReader.java:306)
        at org.apache.lucene.index.SegmentReader.get(SegmentReader.java:269)
        at 
org.apache.lucene.index.DirectoryIndexReader$1.doBody(DirectoryIndexReader.java:99)
        at 
org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:653)
        at 
org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:111)
        at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
        at org.apache.lucene.index.IndexReader.open(IndexReader.java:227)
        at org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:55)
        at Test.main(Test.java:8)

CheckIndex.Status value for this index:
  clean=false
  missingSegments=false
  cantOpenSegments=false
  segmentsFileName=segments_11a
  numSegments=1
  segmentFormat="FORMAT_CHARED_DOC_STORE[Lucene 2.3]"
  segmentsChecked is an empty ArrayList of 10 elements
  toolOutOfDate=false
(let me know if you need values of the rest of the attributes)

I have ran the fixIndex( CheckIndex.Status ) which seemed to fix the
problem (creating IndexSearcher does not throw exceptions any more).
Btw, I was pretty sure this index was created using v2.4.0 - I'm
terribly sorry for misleading Erick in previous email.

Last but not least, thanks a lot for the amazing support, hopefully
this issue can benefit to the Lucene library as well.

Regards,
Mindaugas

On Wed, Oct 29, 2008 at 3:12 PM, Michael McCandless
<[EMAIL PROTECTED]> wrote:
>
> I think I see how this exception can happen.  I think you are hitting a
> different exception, which is masked by the exception you're seeing.
>
> Can you run CheckIndex on this index?  I think that should show the actual
> root cause.
>
> I think another simple way to see the root cause would be to separately
> first open the directory:
>
>  Directory dir = FSDirectory.getDirectory("/path/to/index");
>
> And then instantiate your IndexSearcher with that dir.
>
> Is there only 1 segment in the index?
>
> I see a path whereby on opening a SegmentReader (ie there's only a single
> segment), on then hitting an exception we call doClose() on the
> SegmentReader, which will close the directory, but then the retry logic
> (trying different segments_N files) kicks in which then hits the
> AlreadyClosedException.  It's a bug we should fix (I'll open it & fix it).
>
> Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to