Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 58426 invoked from network); 27 Apr 2004 20:23:53 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 27 Apr 2004 20:23:53 -0000 Received: (qmail 41056 invoked by uid 500); 27 Apr 2004 20:23:36 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 41037 invoked by uid 500); 27 Apr 2004 20:23:36 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 41017 invoked from network); 27 Apr 2004 20:23:36 -0000 Received: from unknown (HELO server1.livestoryboard.com) (209.61.132.12) by daedalus.apache.org with SMTP; 27 Apr 2004 20:23:36 -0000 Received: from koberg.com (livestoryboard.com [209.61.132.12] (may be forged)) (authenticated) by server1.livestoryboard.com (8.11.6/8.11.6) with ESMTP id i3RKRPO08020 for ; Tue, 27 Apr 2004 15:27:25 -0500 Message-ID: <408EC1DD.6050200@koberg.com> Date: Tue, 27 Apr 2004 13:26:05 -0700 From: Robert Koberg Organization: liveSTORYBOARD User-Agent: Mozilla Thunderbird 0.5 (Macintosh/20040208) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Lucene Users List Subject: Re: sorting by date (XML) References: <20040427174942.60483.qmail@web12703.mail.yahoo.com> <408EA1CF.5060807@koberg.com> <57A1E226-9881-11D8-BB92-000393A564E6@ehatchersolutions.com> <408EB77F.8090000@koberg.com> <4532E885-9885-11D8-BB92-000393A564E6@ehatchersolutions.com> In-Reply-To: <4532E885-9885-11D8-BB92-000393A564E6@ehatchersolutions.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Erik Hatcher wrote: > On Apr 27, 2004, at 3:41 PM, Robert Koberg wrote: > >> Oops, I meant to write DateField.timeToString which I use when >> querying. If I use DateField.dateToString when indexing but >> timeToString when searching is that a bad practice? I do only need >> month, day and year. So should I be indexing with timeToString? >> >> How would you do it if the above is still a bad practice? >> >> Sorry for the basic questions... > > > No worries. This is the type of thing that is a "gotcha" with dates, > and is a prime candidate for a wiki page (nudge, nudge)... > > You should represent dates (at index and search time) using YYYYMMDD > format - it needs to be lexicographically ordered. Forget DateField and > Field.Keyword(String,Date) altogether. > > Some tricks are needed if you need to use QueryParser to translate > mm/dd/yyyy format to how you represent it, but it is quite simple. > (subclass QueryParser, override getRangeQuery). Ah. Great - thanks! I see you added it to the wiki. Thanks again :) This is perfect in my case since iso8601 is in the format: 2004-04-27T01:23:33 Luckily so far, from my logs, hardly anyone uses the date search. I guess I should have been doing this from the beginning, don't know why I didn't... best, -Rob > > Erik > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: lucene-user-help@jakarta.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org