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 dabboo <ag...@sapient.com> on 2009/03/12 08:27:48 UTC

Date Search with q query parameter

Hi,

I am facing an issue with the date field, I have in my records.

e.g. I am using q query parameter and passing some string as search criteria
like "test". While creating query with q parameter, how query forms is:

column1:test | column2:test | column3:test . ...

I have one column as date column, which is appended with _dt like
column4_dt. Now, when it creates the query like 

column1:test | column2:test | column3:test | column4_dt:test 

Here it throws an exception saying "Invalid date format".

Please suggest how I can prevent this.

Thanks,
Amit Garg

-- 
View this message in context: http://www.nabble.com/Date-Search-with-q-query-parameter-tp22471072p22471072.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Date Search with q query parameter

Posted by dabboo <ag...@sapient.com>.
Hi,

Date range query is working fine for me. This is the query I entered.

q=productPublicationDate_product_dt:1993-02-01T12:00:00Z&version=2.2&start=0&rows=10&indent=on&qt=dismaxrequest

It threw this exception:

type Status report

message Invalid Date String:'1993-02-01t12'

description The request sent by the client was syntactically incorrect
(Invalid Date String:'1993-02-01t12').


thanks,
Amit Garg


Shalin Shekhar Mangar wrote:
> 
> On Thu, Mar 12, 2009 at 4:39 PM, dabboo <ag...@sapient.com> wrote:
> 
>>
>> Hi,
>>
>> I am able to rectify that exception but now what I am looking for is :
>> How
>> I
>> can pass the value to the date field to search for the record of a
>> specific
>> date value. e.g. I want to retrieve all the records of Jan 01, 2007. How
>> I
>> will pass the value with the column name. If I pass the value it throws
>> an
>> exception saying that "it is expecting TO" ..
>>
> 
> The format for range search is your_date_field:[minDate TO maxDate] and
> for
> a normal term query it is your_date_field:the_date
> 
> Each of the dates should be in the format described in the example
> schema.xml
> -- 
> Regards,
> Shalin Shekhar Mangar.
> 
> 

-- 
View this message in context: http://www.nabble.com/Date-Search-with-q-query-parameter-tp22471072p22474608.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Date Search with q query parameter

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Thu, Mar 12, 2009 at 4:39 PM, dabboo <ag...@sapient.com> wrote:

>
> Hi,
>
> I am able to rectify that exception but now what I am looking for is : How
> I
> can pass the value to the date field to search for the record of a specific
> date value. e.g. I want to retrieve all the records of Jan 01, 2007. How I
> will pass the value with the column name. If I pass the value it throws an
> exception saying that "it is expecting TO" ..
>

The format for range search is your_date_field:[minDate TO maxDate] and for
a normal term query it is your_date_field:the_date

Each of the dates should be in the format described in the example
schema.xml
-- 
Regards,
Shalin Shekhar Mangar.

Re: Date Search with q query parameter

Posted by dabboo <ag...@sapient.com>.
Hi,

I am able to rectify that exception but now what I am looking for is : How I
can pass the value to the date field to search for the record of a specific
date value. e.g. I want to retrieve all the records of Jan 01, 2007. How I
will pass the value with the column name. If I pass the value it throws an
exception saying that "it is expecting TO" ..

Please suggest.

thanks,
Amit Garg



Venu Mittal wrote:
> 
> Is your final query in this format ?
> 
> col1:[2009-01-01T00:00:00Z+TO+2009-01-01T23:59:59Z]
> 
> 
> 
> ________________________________
> From: dabboo <ag...@sapient.com>
> To: solr-user@lucene.apache.org
> Sent: Thursday, March 12, 2009 12:27:48 AM
> Subject: Date Search with q query parameter
> 
> 
> Hi,
> 
> I am facing an issue with the date field, I have in my records.
> 
> e.g. I am using q query parameter and passing some string as search
> criteria
> like "test". While creating query with q parameter, how query forms is:
> 
> column1:test | column2:test | column3:test . ...
> 
> I have one column as date column, which is appended with _dt like
> column4_dt. Now, when it creates the query like 
> 
> column1:test | column2:test | column3:test | column4_dt:test 
> 
> Here it throws an exception saying "Invalid date format".
> 
> Please suggest how I can prevent this.
> 
> Thanks,
> Amit Garg
> 
> -- 
> View this message in context:
> http://www.nabble.com/Date-Search-with-q-query-parameter-tp22471072p22471072.html
> Sent from the Solr - User mailing list archive at Nabble.com.
> 
> 
>       
> 

-- 
View this message in context: http://www.nabble.com/Date-Search-with-q-query-parameter-tp22471072p22473029.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Date Search with q query parameter

Posted by Venu Mittal <me...@yahoo.com>.
Is your final query in this format ?

col1:[2009-01-01T00:00:00Z+TO+2009-01-01T23:59:59Z]



________________________________
From: dabboo <ag...@sapient.com>
To: solr-user@lucene.apache.org
Sent: Thursday, March 12, 2009 12:27:48 AM
Subject: Date Search with q query parameter


Hi,

I am facing an issue with the date field, I have in my records.

e.g. I am using q query parameter and passing some string as search criteria
like "test". While creating query with q parameter, how query forms is:

column1:test | column2:test | column3:test . ...

I have one column as date column, which is appended with _dt like
column4_dt. Now, when it creates the query like 

column1:test | column2:test | column3:test | column4_dt:test 

Here it throws an exception saying "Invalid date format".

Please suggest how I can prevent this.

Thanks,
Amit Garg

-- 
View this message in context: http://www.nabble.com/Date-Search-with-q-query-parameter-tp22471072p22471072.html
Sent from the Solr - User mailing list archive at Nabble.com.