RangeQuery With Date

2005-02-07 Thread Luke Shannon
Hi;

I am working on a set of queries that allow you to find modification dates
before, after and equal to a given date.

Here are some of the before queries I have been playing with. I want a query
that pull up dates modified before Nov 11 2004:

Query query = new RangeQuery(null, new Term(modified, 11/11/04), false);

This one doesn't work. It turns up all the documents in the index.

Query query = QueryParser.parse(modified:[1/1/00 TO 11/11/04], subject,
new StandardAnalyzer());

This works but I don't like having to specify the begin date like this.

Query query = QueryParser.parse(modified:[null TO 11/11/04], subject,
new StandardAnalyzer());

This throws an exception.

How are other doing a Query like this?

Thanks,

Luke



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: RangeQuery With Date

2005-02-07 Thread Luke Francl
Your dates need to be stored in lexicographical order for the RangeQuery
to work.

Index them using this date format: MMDD.

Also, I'm not sure if the QueryParser can handle range queries with only
one end point. You may need to create this query programmatically.

Regards,
Luke Francl


Re: RangeQuery With Date

2005-02-07 Thread Chris Hostetter
: Your dates need to be stored in lexicographical order for the RangeQuery
: to work.
:
: Index them using this date format: MMDD.
:
: Also, I'm not sure if the QueryParser can handle range queries with only
: one end point. You may need to create this query programmatically.

and when creating them progromaticaly, you need to use the exact same
format they were indexed in.  Assuming I've corectly guess what your
indexing code looks like, you probably want...

Query query = new RangeQuery(null, new Term(modified, 2004), false);




-Hoss


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: RangeQuery With Date

2005-02-07 Thread Luke Shannon
Bingo. Thanks!

Luke

- Original Message - 
From: Chris Hostetter [EMAIL PROTECTED]
To: Lucene Users List lucene-user@jakarta.apache.org
Sent: Monday, February 07, 2005 5:10 PM
Subject: Re: RangeQuery With Date


 : Your dates need to be stored in lexicographical order for the RangeQuery
 : to work.
 :
 : Index them using this date format: MMDD.
 :
 : Also, I'm not sure if the QueryParser can handle range queries with only
 : one end point. You may need to create this query programmatically.

 and when creating them progromaticaly, you need to use the exact same
 format they were indexed in.  Assuming I've corectly guess what your
 indexing code looks like, you probably want...

 Query query = new RangeQuery(null, new Term(modified, 2004),
false);




 -Hoss


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]