You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by bbarani <bb...@gmail.com> on 2011/03/03 17:14:33 UTC

Omit hour-min-sec in search?

Hi,

Is there a way to omit hour-min-sec in SOLR date field during search?

I have indexed a field using TrieDateField and seems like it uses UTC
format. The dates get stored as below,

lastupdateddate">2008-02-26T20:40:30.94Z

I want to do a search based on just YYYY-MM-DD and omit T20:40:30.94Z.. Not
sure if its feasible, just want to check if its possible.

Also most of the data in our source doesnt have time information hence we
are very much interested in just storing the date without time or even if
its stored with some default timestamp we want to search just using date
without using the timestamp.

Thanks,
Barani



--
View this message in context: http://lucene.472066.n3.nabble.com/Omit-hour-min-sec-in-search-tp2625840p2625840.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Omit hour-min-sec in search?

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Sun, Mar 6, 2011 at 4:40 PM, Jan Høydahl <ja...@cominvent.com> wrote:
>> Not sure if there is a means of doing explicitly what you ask, but you
>> could do a date range:
>>
>> +mydate:[YYYY-MM-DD 0:0:0 TO YYYY-MM-DD 11:59:59]
>
> This would not work. It has to be on the YYYY-MM-DDT00:00:00Z format.
>
> But I agree that it would be handy if the DateField could support a date-only format mydate:[YYYY-MM-DD TO YYYY-MM-DD]
> It could simply default to midnight UTC.

Since we've added FieldType.getRangeQuery, there's no reason this
couldn't be supported.

-Yonik
http://lucidimagination.com

Re: Omit hour-min-sec in search?

Posted by Andreas Kemkes <a5...@yahoo.com>.
How about [YYYY-MM-DDThh:mm:ssZ/DAY TO YYYY-MM-DDThh:mm:ssZ+1DAY/DAY]?  See 
DateField.html in your Solr API documentation for more.

Andreas



________________________________
From: Jan Høydahl <ja...@cominvent.com>
To: solr-user@lucene.apache.org
Sent: Sun, March 6, 2011 1:40:59 PM
Subject: Re: Omit hour-min-sec in search?

> Not sure if there is a means of doing explicitly what you ask, but you
> could do a date range:
> 
> +mydate:[YYYY-MM-DD 0:0:0 TO YYYY-MM-DD 11:59:59]

This would not work. It has to be on the YYYY-MM-DDT00:00:00Z format.

But I agree that it would be handy if the DateField could support a date-only 
format mydate:[YYYY-MM-DD TO YYYY-MM-DD]
It could simply default to midnight UTC.

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com


      

Re: Omit hour-min-sec in search?

Posted by Jan Høydahl <ja...@cominvent.com>.
> Not sure if there is a means of doing explicitly what you ask, but you
> could do a date range:
> 
> +mydate:[YYYY-MM-DD 0:0:0 TO YYYY-MM-DD 11:59:59]

This would not work. It has to be on the YYYY-MM-DDT00:00:00Z format.

But I agree that it would be handy if the DateField could support a date-only format mydate:[YYYY-MM-DD TO YYYY-MM-DD]
It could simply default to midnight UTC.

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com


Re: Omit hour-min-sec in search?

Posted by Shane Perry <th...@gmail.com>.
Not sure if there is a means of doing explicitly what you ask, but you
could do a date range:

+mydate:[YYYY-MM-DD 0:0:0 TO YYYY-MM-DD 11:59:59]

On Thu, Mar 3, 2011 at 9:14 AM, bbarani <bb...@gmail.com> wrote:
> Hi,
>
> Is there a way to omit hour-min-sec in SOLR date field during search?
>
> I have indexed a field using TrieDateField and seems like it uses UTC
> format. The dates get stored as below,
>
> lastupdateddate">2008-02-26T20:40:30.94Z
>
> I want to do a search based on just YYYY-MM-DD and omit T20:40:30.94Z.. Not
> sure if its feasible, just want to check if its possible.
>
> Also most of the data in our source doesnt have time information hence we
> are very much interested in just storing the date without time or even if
> its stored with some default timestamp we want to search just using date
> without using the timestamp.
>
> Thanks,
> Barani
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Omit-hour-min-sec-in-search-tp2625840p2625840.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>