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)

Reply via email to