Mailing List Archive

2 exceptions
Hello,

Do these 2 exceptions look familiar to anyone:


java.lang.ArrayIndexOutOfBoundsException: 111
at java.util.Vector.elementAt(Vector.java(Compiled Code))
at org.apache.lucene.index.FieldInfos.fieldInfo(FieldInfos.java:136)
at org.apache.lucene.index.FieldInfos.fieldName(FieldInfos.java:132)
at
org.apache.lucene.index.SegmentTermEnum.readTerm(SegmentTermEnum.java:134)
at
org.apache.lucene.index.SegmentTermEnum.next(SegmentTermEnum.java:114)
at
org.apache.lucene.index.TermInfosReader.scanEnum(TermInfosReader.java:166)
at
org.apache.lucene.index.TermInfosReader.get(TermInfosReader.java:156)
at
org.apache.lucene.index.SegmentReader.docFreq(SegmentReader.java:205)
at
org.apache.lucene.search.IndexSearcher.docFreq(IndexSearcher.java:91)
at org.apache.lucene.search.Similarity.idf(Similarity.java:104)
at
org.apache.lucene.search.TermQuery.sumOfSquaredWeights(TermQuery.java:76)
at
org.apache.lucene.search.BooleanQuery.sumOfSquaredWeights(BooleanQuery.java:105)
at org.apache.lucene.search.Query.scorer(Query.java:91)
at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:105)
at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:91)
at org.apache.lucene.search.Hits.<init>(Hits.java:81)
at org.apache.lucene.search.Searcher.search(Searcher.java:75)
at org.apache.lucene.search.Searcher.search(Searcher.java:69)


The second exception that I am getting is this:

java.io.IOException: Interrupted system call
at java.io.RandomAccessFile.seek(Native Method)
at
org.apache.lucene.store.FSInputStream.readInternal(FSDirectory.java:271)
at org.apache.lucene.store.InputStream.refill(InputStream.java:166)
at
org.apache.lucene.store.InputStream.readVInt(InputStream.java(Compiled
Code))
at
org.apache.lucene.store.InputStream.readVInt(InputStream.java(Compiled
Code))
at
org.apache.lucene.index.SegmentTermEnum.readTerm(SegmentTermEnum.java:127)
at
org.apache.lucene.index.SegmentTermEnum.next(SegmentTermEnum.java:114)
at
org.apache.lucene.index.TermInfosReader.scanEnum(TermInfosReader.java:166)
at
org.apache.lucene.index.TermInfosReader.get(TermInfosReader.java:161)
at
org.apache.lucene.index.SegmentReader.docFreq(SegmentReader.java:205)
at
org.apache.lucene.search.IndexSearcher.docFreq(IndexSearcher.java:91)
at org.apache.lucene.search.Similarity.idf(Similarity.java:104)
at
org.apache.lucene.search.TermQuery.sumOfSquaredWeights(TermQuery.java:76)
at
org.apache.lucene.search.BooleanQuery.sumOfSquaredWeights(BooleanQuery.java:105)
at org.apache.lucene.search.Query.scorer(Query.java:91)
at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:105)
at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:91)
at org.apache.lucene.search.Hits.<init>(Hits.java:81)
at org.apache.lucene.search.Searcher.search(Searcher.java:75)
at org.apache.lucene.search.Searcher.search(Searcher.java:69)


Any search I make in a multi-threaded environment seems to fail withone
of these exceptions.
The search code in use looks like this:

try
{
// if the index has been modified since opened, re-open it.
if (IndexReader.lastModified(_paIndexDir) >= _paIndexLastMod)
{
_paIndexLastMod = new Date().getTime();
if (_paIndexSearcher != null)
_paIndexSearcher.close();
_paIndexLastMod = new Date().getTime();
}
if (_paIndexSearcher == null)
_paIndexSearcher = new IndexSearcher(_paIndexDir);
}
catch (IOException e)
{
_log.error("Could not open/close IndexSearcher: " +
e.getMessage());
return;
}

Query query = null;
Hits hits = null;
try {
query = MultiFieldQueryParser.parse(queryString, new String[]
{"title", "description"}, _analyzer);
hits = _paIndexSearcher.search(query);
} catch (ParseException e) {
_log.warn("QueryParser threw ParseException while parsing: " +
queryString, e);
} catch (TokenMgrError e) {
_log.warn("QueryParser threw TokenMgrException while parsing: " +
queryString, e);
} catch (IOException e) {
_log.error("IndexSearcher threw IOException while searching for: "
+
queryString, e);
}

I'm about to look at the source, but if any of these exceptions look
familiar to anyone, or if you see a flaw in the code above please let
me know.

Thanks,
Otis


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: 2 exceptions [ In reply to ]
Just for the list/knowledge archive:

I found the source of one of the exceptions in my code:

> java.io.IOException: Interrupted system call
> at java.io.RandomAccessFile.seek(Native Method)
> at
>
org.apache.lucene.store.FSInputStream.readInternal(FSDirectory.java:271)
> at
> // if the index has been modified since opened, re-open it.
> if (IndexReader.lastModified(_paIndexDir) >= _paIndexLastMod)
> {
> _paIndexLastMod = new Date().getTime();
> if (_paIndexSearcher != null)
> _paIndexSearcher.close();
> _paIndexLastMod = new Date().getTime();
> }
> if (_paIndexSearcher == null)
> _paIndexSearcher = new IndexSearcher(_paIndexDir);
BUG: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
And what if it's != null? It's already close()d above.

The other one might have been a side-effect of the above bug.

Otis


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>