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 Claude Devarenne <cl...@library.ucsf.edu> on 2004/07/14 23:58:54 UTC

ArrayIndexOutOfBoundsException if stopword on left of bool clause w/ StandardAnalyzer

Hi,

A user mistyped their search terms and entered a query that looked like  
this:

the AND title:bla

I am using lucene 1.4 rc3. My web app,  which is using a  
StandardAnalyzer, got an ArrayIndexOutOfBoundsException (stack trace  
below).  I can reproduce this with the lucene demo (both the jsp and  
the comand line util).

Since I have the queryParser.parse(queryString) call in a try statement  
I am now catching this exception so it fixes the issue.

My question is: should the queryParser catch that there is no term  
before trying to add a clause when using a StandardAnalyzer?  Is this  
even possible? Should the burden be on the application to either catch  
the exception or parse the query before handing it out to the  
queryParser?

Claude


Here is the stack trace:

java.lang.ArrayIndexOutOfBoundsException: -1 < 0
java.util.Vector.elementAt(Vector.java:437) at
org.apache.lucene.queryParser.QueryParser.addClause(QueryParser.java: 
181)
at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:509)
at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:108)
at QueryExec.runQuery(QueryExec.java:245)

Re: ArrayIndexOutOfBoundsException if stopword on left of bool clause w/ StandardAnalyzer

Posted by Morus Walter <mo...@tanto.de>.
Claude Devarenne writes:
> 
> My question is: should the queryParser catch that there is no term  
> before trying to add a clause when using a StandardAnalyzer?  Is this  
> even possible? Should the burden be on the application to either catch  
> the exception or parse the query before handing it out to the  
> queryParser?
> 
Yes. Yes. No.
There are fixes in bugzilla that would make query parser read that query
as title:bla and simply drop the stop word.

see http://issues.apache.org/bugzilla/show_bug.cgi?id=9110
http://issues.apache.org/bugzilla/show_bug.cgi?id=25820

Morus

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