FAQ
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

Search Discussions

  • Erick Erickson at May 23, 2006 at 2:58 pm
    Hold the presses. I can't get my junit test to show this as a problem. So
    I'm exploring further. It may be some weird interaction with my index. I'll
    post more later.

    Sorry for the spam.

    Erick
  • Lee_gary at Feb 6, 2007 at 12:38 am
    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
    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: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Paul Elschot at Feb 6, 2007 at 8:16 am
    Gentlemen,

    Have a look here:
    https://issues.apache.org:443/jira/browse/LUCENE-413
    This was fixed in 2.0.

    Regards,
    Paul Elschot



    On Tuesday 06 February 2007 01:38, Lee_Gary@emc.com wrote:
    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
    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: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Russ at Feb 7, 2007 at 1:58 pm
    You're not Gary Lee that went to poly, are you?
    Sent wirelessly via BlackBerry from T-Mobile.

    -----Original Message-----
    From: Lee_Gary@emc.com
    Date: Mon, 5 Feb 2007 19:38:03
    To:<java-user@lucene.apache.org>
    Subject: RE: An arguable bug in Lucene 1.9.1

    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
    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: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Russ at Feb 7, 2007 at 2:23 pm
    Sorry, didn't mean for this to go to the list...

    Russ
    Sent wirelessly via BlackBerry from T-Mobile.

    -----Original Message-----
    From: "Russ" <rsivak@istandfor.com>
    Date: Wed, 7 Feb 2007 13:56:41
    To:java-user@lucene.apache.org
    Subject: Re: An arguable bug in Lucene 1.9.1

    You're not Gary Lee that went to poly, are you?
    Sent wirelessly via BlackBerry from T-Mobile.

    -----Original Message-----
    From: Lee_Gary@emc.com
    Date: Mon, 5 Feb 2007 19:38:03
    To:<java-user@lucene.apache.org>
    Subject: RE: An arguable bug in Lucene 1.9.1

    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
    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: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedMay 23, '06 at 2:23p
activeFeb 7, '07 at 2:23p
posts6
users4
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase