FAQ
Hello,

Is there any benefit of using one or other for "start with query"?


Regards
--
View this message in context: http://www.nabble.com/PrefixQuery-vs-wildcardquery-tp25649045p25649045.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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

Search Discussions

  • Mark Miller at Sep 28, 2009 at 5:07 pm

    John Seer wrote:
    Hello,

    Is there any benefit of using one or other for "start with query"?

    Which one is faster?


    Regards
    Prefix query is a bit more efficient - not sure what it turns into
    realworld, but prefix just checks if the term's start with the prefix -
    wildcard has a bit more complicated check to do (there could be a
    wildcard anywhere in the term that must be checked for). I'd be
    surprised if it was a huge difference, but if there are a lot of terms
    to check, it could.

    --
    - Mark

    http://www.lucidimagination.com




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Entdeveloper at Sep 28, 2009 at 5:23 pm

    John Seer wrote:

    Hello,

    Is there any benefit of using one or other for "start with query"?

    Which one is faster?


    Regards
    It seems that you've answered your own question. If you want a "start with
    query", this is exactly what a PrefixQuery is for. WildcardQuery gives you
    more flexibility, but if you don't need it, then PrefixQuery should get the
    job done.
    --
    View this message in context: http://www.nabble.com/PrefixQuery-vs-wildcardquery-tp25649045p25649399.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Simon Willnauer at Sep 28, 2009 at 7:05 pm
    Depending on your usecase you might want to use the PrefixFilter
    instead of PrefixQuery which can be way more efficient than a query.
    With a filter you have the possibility to cache it very easily and you
    are not exposed to issued related to the length of the prefix. If you
    have a very short prefix and in turn lots of terms matching that
    prefix you might run into problems with TooManyBooleanClauses
    expections. The downside is that a filter will not contribute to the
    score of a document.
    Just wanna point you to it if it is an alternative.

    simon

    On Mon, Sep 28, 2009 at 7:23 PM, entdeveloper
    wrote:

    John Seer wrote:
    Hello,

    Is there any benefit of using one or other for "start with query"?

    Which one is faster?


    Regards
    It seems that you've answered your own question. If you want a "start with
    query", this is exactly what a PrefixQuery is for. WildcardQuery gives you
    more flexibility, but if you don't need it, then PrefixQuery should get the
    job done.
    --
    View this message in context: http://www.nabble.com/PrefixQuery-vs-wildcardquery-tp25649045p25649399.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


    ---------------------------------------------------------------------
    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
  • Mark Miller at Sep 28, 2009 at 9:19 pm
    Though in 2.9 this is not much of a concern - the multi term queries
    are smart - if it matches few enough terms it will rewrite to a
    constant score booleanquery - if it matches a lot of terms it will
    rewrite to a constantscore query - using a filter underneath. So
    maxclause issues should no longer be an issue.

    - Mark

    http://www.lucidimagination.com (mobile)
    On Sep 28, 2009, at 3:05 PM, Simon Willnauer wrote:

    Depending on your usecase you might want to use the PrefixFilter
    instead of PrefixQuery which can be way more efficient than a query.
    With a filter you have the possibility to cache it very easily and you
    are not exposed to issued related to the length of the prefix. If you
    have a very short prefix and in turn lots of terms matching that
    prefix you might run into problems with TooManyBooleanClauses
    expections. The downside is that a filter will not contribute to the
    score of a document.
    Just wanna point you to it if it is an alternative.

    simon

    On Mon, Sep 28, 2009 at 7:23 PM, entdeveloper
    wrote:

    John Seer wrote:
    Hello,

    Is there any benefit of using one or other for "start with query"?

    Which one is faster?


    Regards
    It seems that you've answered your own question. If you want a
    "start with
    query", this is exactly what a PrefixQuery is for. WildcardQuery
    gives you
    more flexibility, but if you don't need it, then PrefixQuery should
    get the
    job done.
    --
    View this message in context: http://www.nabble.com/PrefixQuery-vs-wildcardquery-tp25649045p25649399.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


    ---------------------------------------------------------------------
    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
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Simon Willnauer at Sep 28, 2009 at 9:50 pm
    Ha! I need to get used to the fact that 2.9 is out there already :)
    Thanks mark for the addition.

    simon
    On Mon, Sep 28, 2009 at 11:18 PM, Mark Miller wrote:
    Though in 2.9 this is not much of a concern - the multi term queries are
    smart - if it matches few enough terms it will rewrite to a constant score
    booleanquery - if it matches a lot of terms it will rewrite to a
    constantscore query - using a filter underneath. So maxclause issues should
    no longer be an issue.

    - Mark

    http://www.lucidimagination.com (mobile)

    On Sep 28, 2009, at 3:05 PM, Simon Willnauer
    wrote:
    Depending on your usecase you might want to use the PrefixFilter
    instead of PrefixQuery which can be way more efficient than a query.
    With a filter you have the possibility to cache it very easily and you
    are not exposed to issued related to the length of the prefix. If you
    have a very short prefix and in turn lots of terms matching that
    prefix you might run into problems with TooManyBooleanClauses
    expections. The downside is that a filter will not contribute to the
    score of a document.
    Just wanna point you to it if it is an alternative.

    simon

    On Mon, Sep 28, 2009 at 7:23 PM, entdeveloper
    wrote:

    John Seer wrote:
    Hello,

    Is there any benefit of using one or other for "start with query"?

    Which one is faster?


    Regards
    It seems that you've answered your own question. If you want a "start
    with
    query", this is exactly what a PrefixQuery is for. WildcardQuery gives
    you
    more flexibility, but if you don't need it, then PrefixQuery should get
    the
    job done.
    --
    View this message in context:
    http://www.nabble.com/PrefixQuery-vs-wildcardquery-tp25649045p25649399.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


    ---------------------------------------------------------------------
    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
    ---------------------------------------------------------------------
    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedSep 28, '09 at 4:59p
activeSep 28, '09 at 9:50p
posts6
users4
websitelucene.apache.org

People

Translate

site design / logo © 2021 Grokbase