lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Carlson <carl...@bookandhammer.com>
Subject Re: Searching in date ranges
Date Tue, 29 Oct 2002 16:13:48 GMT
Hi Terry,


I think since you are using a different method, i.e. yyyyMMdd format 
instead of DateField.dateToString it should work fine.

I think that the main difference is that DateField also includes the 
time, where your format only includes the actual day.

If you are using the DateField, I would suggest using a Keyword so it 
doesn't tokenize if there are any special characters that it gets 
converted into. Using the yyyyMMdd method should work fine with Text 
since there are no tokens that would break it up into multiple Terms.

Note that the DateField format has a limitation of only converting 
dates past 1970.

I like the yyyyMMdd method, but I don't like the requirement of the 
reverse order of dates on the user, just a personal preference.


--Peter



On Tuesday, October 29, 2002, at 07:56 AM, Terry Steichen wrote:

> Peter,
>
> I'm not sure if I'm doing it right, but I use a Text Field (rather than
> Keyword) for my (string-based) date which allows me to use wildcards 
> (such
> as date:200210* for all documents published in October) as well as 
> range
> queries (like date:[20021001 - 20021031].  Does that make sense?
>
> Regards,
>
> Terry
>
> ----- Original Message -----
> From: "Peter Carlson" <carlson@bookandhammer.com>
> To: "Lucene Users List" <lucene-user@jakarta.apache.org>
> Sent: Tuesday, October 29, 2002 10:44 AM
> Subject: Searching in date ranges
>
>
>> Hi Kajal,
>>
>> When you create you document, create a date field. The data you put in
>> that date field will be a Field.Keyword(dateString)
>>
>> Note when you convert the date to a string, make sure that it is in 
>> the
>> format yyyyMMdd
>>
>> Then you can use the built-in query parser range search tokens [ ].
>>
>> So an example search would be
>>
>> [20020101 - 20021028]
>>
>> This would search from jan 1, 2002 to oct 28, 2002.
>>
>> Note that you must have a space on either side of the -
>>
>> There are nicer ways to do it that don't have these limitations, but
>> this is the fastest.
>>
>> I hope this helps.
>>
>> Also, please use more descriptive subject lines.
>>
>> --Peter
>>
>> On Tuesday, October 29, 2002, at 07:19 AM, Murthy, Suryanarayana (MED,
>> TCS) wrote:
>>
>>> Hi Kelvin,
>>> Could you please tell me the steps how to implement search engine for
>>> the
>>> intranet site with Lucene. I have gone through the documentation at 
>>> the
>>> site.
>>> This is a starting problem for me.
>>>
>>> Thanks & Regards,
>>> Murthy
>>>
>>> -----Original Message-----
>>> From: Kelvin Tan [mailto:kelvin-lists@relevanz.com]
>>> Sent: Tuesday, October 29, 2002 10:22 AM
>>> To: Lucene Users List
>>> Subject: Re: Urgent
>>>
>>> Kajal,
>>>
>>> Index the date fields using Field.Keyword, and use a DateFilter to
>>> limit
>>> the results you need.
>>>
>>> Regards,
>>> Kelvin
>>>
>>>
>>> On Tue, 29 Oct 2002 14:33:43 +0530, kbharwada@eq-technologic.com 
>>> wrote:
>>>> Hi
>>>>
>>>> I would like to implement a search with date range. Can anyone
>>>> explain how
>>>> do i go about implementing this. I have enabled search on our
>>>> intranet site
>>>> and want to make changes to results.jsp so as to include the date
>>>> option as
>>>> well.
>>>>
>>>> Kajal
>>>>
>>>>
>>>> --
>>>> To unsubscribe, e-mail:   <mailto:lucene-user-
>>>> unsubscribe@jakarta.apache.org>
>>>> For additional commands, e-mail: <mailto:lucene-user-
>>>> help@jakarta.apache.org>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <mailto:lucene-user-help@jakarta.apache.org>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <mailto:lucene-user-help@jakarta.apache.org>
>>>
>>>
>>
>>
>> --
>> To unsubscribe, e-mail:
> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
>> For additional commands, e-mail:
> <mailto:lucene-user-help@jakarta.apache.org>
>>
>>
>
>
> --
> To unsubscribe, e-mail:   
> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:lucene-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message