Yeah, I was thinking of something similar, too.  Would the following be even 
simpler?


<fieldType name="date" class="solr.DateField" sortMissingLast="true" 
omitNorms="true" round="UP_MINUTE" />
or
<fieldType name="date" class="solr.DateField" sortMissingLast="true" 
omitNorms="true" round="DOWN_MINUTE" />

- Single new attrib name.
- Shorted attrib name.
- No +/- and number+time unit mix
- Self-descriptive and "naturally readable", e.g.: round up to minutes

What do you think?

Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch



----- Original Message ----
> From: Shalin Shekhar Mangar <[EMAIL PROTECTED]>
> To: solr-user@lucene.apache.org
> Sent: Thursday, August 28, 2008 12:18:09 PM
> Subject: Re: Rounding date fields
> 
> 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:
> 
> 
> omitNorms="true" roundToNearest="DAY" />
> 
> 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:
> 
> omitNorms="true" roundTo="-1DAY" />
> 
> omitNorms="true" roundTo="-1MINUTE" />
> 
> Similarly we can also have:
> 
> 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