FAQ
Is there a RangeQuery equivalent that can query date range on two
different fields?



Term startTerm = new Term("startDate", "20060710");

Term endTerm = new Term("endDate", "20060711");



RangeQuery q = new RangeQuery(startTerm, endTerm, true);

Search Discussions

  • Chris Hostetter at Jul 12, 2006 at 7:47 am
    1) RangeQuery is the devil, don't use it. If I weren't so lazy I would
    change the javadocs for RangeQuery so that sentence was the class summary.
    Takes a look at RangeFilter or ConstantScoreRangeQuery.

    2) it's not clear what exactly you want your example to mean ... perhaps
    you mean you want to match all docs with a field of "startDate
    greater then "20060710" and a field of "endDate" less then "20060711", in
    which case what you want to do is make a BooleanQuery containing two
    ConstantScoreRangeQueries -- one on the startDate and one on the endDate.
    ... If that's not what you mean, then I don't understand your question.

    : Is there a RangeQuery equivalent that can query date range on two
    : different fields?
    :
    :
    :
    : Term startTerm = new Term("startDate", "20060710");
    :
    : Term endTerm = new Term("endDate", "20060711");
    :
    :
    :
    : RangeQuery q = new RangeQuery(startTerm, endTerm, true);



    -Hoss


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Van Nguyen at Jul 12, 2006 at 9:54 pm
    Exactly what I was looking for.

    Thanks!

    -----Original Message-----
    From: Chris Hostetter
    Sent: Wednesday, July 12, 2006 12:47 AM
    To: java-user@lucene.apache.org
    Subject: Re: RangeQuery question?


    1) RangeQuery is the devil, don't use it. If I weren't so lazy I would
    change the javadocs for RangeQuery so that sentence was the class
    summary.
    Takes a look at RangeFilter or ConstantScoreRangeQuery.

    2) it's not clear what exactly you want your example to mean ... perhaps
    you mean you want to match all docs with a field of "startDate
    greater then "20060710" and a field of "endDate" less then "20060711",
    in
    which case what you want to do is make a BooleanQuery containing two
    ConstantScoreRangeQueries -- one on the startDate and one on the
    endDate.
    ... If that's not what you mean, then I don't understand your question.

    : Is there a RangeQuery equivalent that can query date range on two
    : different fields?
    :
    :
    :
    : Term startTerm = new Term("startDate", "20060710");
    :
    : Term endTerm = new Term("endDate", "20060711");
    :
    :
    :
    : RangeQuery q = new RangeQuery(startTerm, endTerm, true);



    -Hoss


    ---------------------------------------------------------------------
    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
postedJul 11, '06 at 8:04p
activeJul 12, '06 at 9:54p
posts3
users2
websitelucene.apache.org

2 users in discussion

Van Nguyen: 2 posts Chris Hostetter: 1 post

People

Translate

site design / logo © 2021 Grokbase