Hi Otis,

This seems like a common use-case since it is suggested often. We should add
this capability to the solr.DateField.

I propose the following syntax similar to the DateMath syntax:

<fieldType name="date" class="solr.DateField" sortMissingLast="true"
omitNorms="true" roundToNearest="DAY" />
<fieldType name="date" class="solr.DateField" sortMissingLast="true"
omitNorms="true" roundToNearest="MINUTE" />

Any date will be rounded to the nearest specified time and less significant
units will be set to their least possible value.

If it is not desirable to round to nearest element (many times users don't
want a value greater than given value), we can have:
<fieldType name="date" class="solr.DateField" sortMissingLast="true"
omitNorms="true" roundTo="-1DAY" />
<fieldType name="date" class="solr.DateField" sortMissingLast="true"
omitNorms="true" roundTo="-1MINUTE" />

Similarly we can also have:
<fieldType name="date" class="solr.DateField" sortMissingLast="true"
omitNorms="true" roundTo="+1MINUTE" />

Thoughts?

On Thu, Aug 28, 2008 at 9:01 PM, Otis Gospodnetic <
[EMAIL PROTECTED]> wrote:

> Hi,
>
> How do people tend to round date type fields when they don't need
> millisecond precision?
>
> Using just the straight "date" type leaves you with date/time info down to
> milliseconds.  What if you want to round that up to minutes, for example?
>  Is there a way to tell the "date" type to do that?  Or do people simply
> round dates manually before indexing and then index them not as "date" type,
> but as "string" type, for example: "2008-08-28 23:30"?
>
>
> Thanks,
> Otis
> --
> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>
>


-- 
Regards,
Shalin Shekhar Mangar.

Reply via email to