lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject An arguable bug in Lucene 1.9.1
Date Tue, 23 May 2006 14:22:51 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message