lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Pimley <ppim...@semantico.com>
Subject QueryParser: "[stopword] AND something" throws Exception
Date Fri, 12 Nov 2004 16:52:23 GMT

[this is using lucene-1.4-final]

Hello.

I have just encountered a way to get the QueryParser to throw an 
ArrayIndexOutOfBoundsException.  It can be recreated with the demo 
org.apache.lucene.demo.SearchFiles program.  The way to trigger it is to 
parse a query of the form:

"a AND b"

...where 'a' is a stop word.  For example, "the AND vector".  It only 
happens when the -first- term is a stop word.  You could search for 
"vector AND the" or "vector AND the AND class", and it works as you 
would expect (i.e. the stop words are ignored).

Unfortunately I am up against a deadline right now so I can't fix this 
myself.  I'm just going to filter out stop words before feeding them to 
the query parser.  I'll try to have a look at it in roughly 2 weeks time 
if nobody else has solved it.

Peter Pimley,
Semantico

Here is the stack trace.

java.lang.ArrayIndexOutOfBoundsException: -1
        at java.util.Vector.elementAt(Vector.java:434)
        at 
org.apache.lucene.queryParser.QueryParser.addClause(QueryParser.java:181)
        at 
org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:529)
        at 
org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:561)
        at 
org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:500)
        at 
org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:561)
        at 
org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:500)
        at 
org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:108)
        at 
org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:87)


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


Mime
View raw message