I am far from perfect in this pdf text extracting, however I noticed
something in your code that you may want to check to clear up the reason
for this failure, see below..

"Shivani Sawhney" <[EMAIL PROTECTED]> wrote on 12/10/2006
22:54:07:
> Hi All,
>
> I am facing a peculiar problem.
>
> I am trying to index a file and the indexing code executes without any
error
> but when I try to close the indexer, I get the following error and the
error
> comes very rarely but when it does, no code on document indexing works
and I
> finally have to delete all indexes and run a re-indexing utility.
>
> Can anyone please suggest what might be the problem?
>
> Stack Trace:
>
> java.lang.ArrayIndexOutOfBoundsException: 97 >= 17
>             at java.util.Vector.elementAt(Vector.java:432)
>             at
> org.apache.lucene.index.FieldInfos.fieldInfo(FieldInfos.java:135)
>             at
> org.apache.lucene.index.FieldsReader.doc(FieldsReader.java:103)
>             at
> org.apache.lucene.index.SegmentReader.document(SegmentReader.java:237)
>             at
> org.apache.lucene.index.SegmentMerger.mergeFields(SegmentMerger.java:169)
>             at
> org.apache.lucene.index.SegmentMerger.merge(SegmentMerger.java:97)
>             at
> org.apache.lucene.index.IndexWriter.mergeSegments(IndexWriter.java:425)
>             at
>
org.apache.lucene.index.IndexWriter.flushRamSegments(IndexWriter.java:373)
>             at
> org.apache.lucene.index.IndexWriter.close(IndexWriter.java:193)
>             at rd.admin.Indexer.indexFile(Indexer.java:150)
> ...
> ...
>    try {
>      indexwriter.addDocument(documentWithCustomFields);

Here documentWithCustomFields is added to the index, but the code provided
does not handle this doc variable at all... might be just a typo in the
code snippet (i.e. if you cleaned it for the mail), or else a real problem
in the code, attempting to add to the index the wrong, perhaps null,
document?

>    } catch (IOException e) {
>      closeIndexWriter(indexwriter);

Here, once catching an exception, you are first attempting to close the
index and only then print the exception e. So if this "close" line is
throwing the exception with the stack trace above, you can't really know
that addDocument "executes without any error". Better switch between these
2 lines.

>      e.printStackTrace();
>      throw new MyRuntimeException(e.getMessage(), e);
>    }
>

There are 2 calls in your code to closeIndexWriter() and I can't tell which
line is Indexer.java:150, is it this one:
    doIndexing(indexwriter, resumeFile);
    closeIndexWriter(indexwriter);
Or this one:
    } catch (IOException e) {
      closeIndexWriter(indexwriter);

Hope this helps at all.

If not - add some info on the exception, also on the code path taken before
getting this error (many ifs in this code), and lucene version used.

Regards,
Doron


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

Reply via email to