FAQ
A simple question and I guess it may have been asked before.

Does the order of Querys in a BooleanQuery affect search speed? By this I
mean if the first clause of a BooleanQuery only returns a few results and
the second clause returns lots of results and the two are ANDed is this
faster than the other way around? Similarly, does searching stop if no
results are found and the logical operations would mean no results can be
found (similar to Javas "short circuiting" of logical operations)?

I ask because I am creating some reasonably complex queries and if I can
get a boost by simply organising the logic sensibly then I will.

Regards

Paul I.


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

Search Discussions

  • Mordo, Aviran (EXP N-NANNATEK) at Aug 26, 2005 at 4:23 pm
    As far as I remember the order of Queries in a BooleanQuery does not
    affect performance. (but I may be wrong)

    Aviran
    http://www.aviransplace.com

    -----Original Message-----
    From: Paul.Illingworth@saaconsultants.com

    Sent: Friday, August 26, 2005 11:59 AM
    To: java-user@lucene.apache.org
    Subject: Does order of BooleanQuery clauses affect search performance?





    A simple question and I guess it may have been asked before.

    Does the order of Querys in a BooleanQuery affect search speed? By this
    I mean if the first clause of a BooleanQuery only returns a few results
    and the second clause returns lots of results and the two are ANDed is
    this faster than the other way around? Similarly, does searching stop if
    no results are found and the logical operations would mean no results
    can be found (similar to Javas "short circuiting" of logical
    operations)?

    I ask because I am creating some reasonably complex queries and if I can
    get a boost by simply organising the logic sensibly then I will.

    Regards

    Paul I.


    ---------------------------------------------------------------------
    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
  • Paul Elschot at Aug 26, 2005 at 6:40 pm

    On Friday 26 August 2005 17:58, Paul.Illingworth@saaconsultants.com wrote:

    A simple question and I guess it may have been asked before.

    Does the order of Querys in a BooleanQuery affect search speed? By this I
    mean if the first clause of a BooleanQuery only returns a few results and
    the second clause returns lots of results and the two are ANDed is this
    faster than the other way around? Similarly, does searching stop if no
    Subqueries of BooleanQuery are called clauses in Lucene.
    The order of clauses does not matter.
    Having only required clauses does matter, normally a lot.
    results are found and the logical operations would mean no results can be
    found (similar to Javas "short circuiting" of logical operations)?
    The development version tries to do as much "short circuiting" as possible.
    Lucene 1.4.3 neither short circuits for "or" (optional clauses)
    nor for "not" (prohibited clauses).
    Both do short circuiting for "and" (required clauses).

    Regards,
    Paul Elschot


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Maxim Patramanskij at Dec 5, 2005 at 6:30 am
    Hello Paul,

    Friday, August 26, 2005, 8:40:44 PM, you wrote:

    PE> On Friday 26 August 2005 17:58, Paul.Illingworth@saaconsultants.com wrote:
    A simple question and I guess it may have been asked before.

    Does the order of Querys in a BooleanQuery affect search speed? By this I
    mean if the first clause of a BooleanQuery only returns a few results and
    the second clause returns lots of results and the two are ANDed is this
    faster than the other way around? Similarly, does searching stop if no
    PE> Subqueries of BooleanQuery are called clauses in Lucene.
    PE> The order of clauses does not matter.
    PE> Having only required clauses does matter, normally a lot.
    results are found and the logical operations would mean no results can be
    found (similar to Javas "short circuiting" of logical operations)?
    PE> The development version tries to do as much "short circuiting" as possible.
    PE> Lucene 1.4.3 neither short circuits for "or" (optional clauses)
    PE> nor for "not" (prohibited clauses).
    PE> Both do short circuiting for "and" (required clauses).

    PE> Regards,
    PE> Paul Elschot


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




    --
    Best regards,
    Maxim mailto:max@osua.de


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Maxim Patramanskij at Dec 5, 2005 at 6:39 am
    Hello Paul,

    Friday, August 26, 2005, 8:40:44 PM, you wrote:

    PE> On Friday 26 August 2005 17:58, Paul.Illingworth@saaconsultants.com wrote:
    A simple question and I guess it may have been asked before.

    Does the order of Querys in a BooleanQuery affect search speed? By this I
    mean if the first clause of a BooleanQuery only returns a few results and
    the second clause returns lots of results and the two are ANDed is this
    faster than the other way around? Similarly, does searching stop if no
    PE> Subqueries of BooleanQuery are called clauses in Lucene.
    PE> The order of clauses does not matter.
    PE> Having only required clauses does matter, normally a lot.
    results are found and the logical operations would mean no results can be
    found (similar to Javas "short circuiting" of logical operations)?
    PE> The development version tries to do as much "short circuiting" as possible.
    PE> Lucene 1.4.3 neither short circuits for "or" (optional clauses)
    PE> nor for "not" (prohibited clauses).
    PE> Both do short circuiting for "and" (required clauses).

    PE> Regards,
    PE> Paul Elschot


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




    --
    Best regards,
    Maxim mailto:max@osua.de


    ---------------------------------------------------------------------
    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
postedAug 26, '05 at 3:56p
activeDec 5, '05 at 6:39a
posts5
users4
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase