I am seeing this issue as well with the exact same stack trace using
spanQueries. Does anyone know if this has been fixed for versions after
1.9.1?

Thanks
Gary 

-----Original Message-----
From: Erick Erickson [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 23, 2006 07:23 AM
To: java-user@lucene.apache.org
Subject: An arguable bug in Lucene 1.9.1

I'm constructing a BooleanQuery across several fields with
SpanNearQuerys.
In the degenerate case of spanning *one* term, AND adding a non-span
clause, I get an exception thrown. Of course you can argue that a span
query over one term is silly and shouldn't be done, but I thought I'd
mention this. I'm content with whatever y'all decide.

Here's the results of a BooleanQuery.toString:

+(spanNear([person:john], 20, false) spanNear([text:john], 5, false))
+groupid:14075

This results in the following stack trace:

ava.lang.ArrayIndexOutOfBoundsException: 4
    at org.apache.lucene.search.BooleanScorer2$Coordinator.coordFactor(
BooleanScorer2.java:54)
    at org.apache.lucene.search.BooleanScorer2.score(BooleanScorer2.java
:328)
    at org.apache.lucene.search.ConjunctionScorer.score(
ConjunctionScorer.java:82)
    at
org.apache.lucene.search.BooleanScorer2$2.score(BooleanScorer2.java
:186)
    at org.apache.lucene.search.BooleanScorer2.score(BooleanScorer2.java
:327)
    at org.apache.lucene.search.BooleanScorer2.score(BooleanScorer2.java
:291)
    at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:132)
    at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:110)
    at org.apache.lucene.search.Searcher.search(Searcher.java:76)
   ****my code here

If I take off the end clause, or have more than one string in the span,
it works. e.g.

+(spanNear([person:john], 20, false) spanNear([text:john], 5, false))

works, as does:

+(spanNear([person:john, person:johnson], 20, false) 
+spanNear([text:john,
text:johnson], 5, false)) +groupid:14075

Of course I can (and will) intercept the creation of the span queries
when there is only one term and use TermQuery instead. I suspect that
this is better practice anyway.

I'll be happy to enter this in bugs database if you think I should.

Best
Erick

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

Reply via email to