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 Bruno Mannina <bm...@free.fr> on 2012/06/22 10:51:27 UTC

Request field date?

Dear All,

I have a standard field date in my docs like:
2005-02-05T23:59:59Z
my field name is publication-date

I would like to request docs (sorl admin) with only one specific year?
I tried:
patent-number:EP* AND title-en:airplane AND publication-date:[2010]

without success :'(

Note:
patent-number:EP* AND title-en:airplane works fine.

Any idea?

thanks a lot,
Bruno



Re: Request field date?

Posted by Jack Krupansky <ja...@basetechnology.com>.
"is it always necessary to write: i.e. 2001-01-23T23:59:59Z?" (rather than 
"2001-01-23")

Unfortunately, today, yes.

There is actually a DateField.parseDateLenient method that supports parsing 
of "2001-01-23", but it is not used on the normal code path - for reasons 
unknown, but is used for function queries.

The code does have some comments:

"
// TODO: make a FlexibleDateField that can accept dates in multiple
// formats, better for human entered dates.

// TODO: make a DayField that only stores the day?
"

-- Jack Krupansky

-----Original Message----- 
From: Bruno Mannina
Sent: Saturday, June 23, 2012 6:12 PM
To: solr-user@lucene.apache.org
Subject: Re: Request field date?

As my index is actually out :'( I can't test it but with your first
method (wildcard) the possibility to search with range becomes
not possible. So I will pre-process my request with the standard date
format field.

Little question: is it always necessary to write:
i.e. 2001-01-23T23:59:59Z
is exist a field date without using the T....Z ?
I mean, I want to write in the <field name="pub-date">2001-01-23</field>

Thx !

PS: I'm always waiting help for my index corrupted, nobody can help me ?


Le 24/06/2012 00:46, Jack Krupansky a écrit :
> Or do a copyField to a "string" field and do a prefix wildcard query using 
> the year: publication-date_s:2010*.
>
> If you are using the LucidWorks Enterprise product, their query parser 
> understands date fields and you can simply type: publication-date:2010
>
> -- Jack Krupansky
>
> -----Original Message----- From: Erick Erickson
> Sent: Friday, June 22, 2012 11:09 AM
> To: solr-user@lucene.apache.org
> Subject: Re: Request field date?
>
> You're a bit stuck, Solr doesn't really recognize partial dates like you 
> want.
>
> What you can do, though, is just create an additional int field for
> year in this case
> and query on that.
>
> Best
> Erick
>
> On Fri, Jun 22, 2012 at 5:07 AM, Bruno Mannina <bm...@free.fr> wrote:
>> Precision:
>> I would like to write something like: [2010*]
>> If I write
>> publication-date:[2010-01-01T23:59:59Z TO 2010-12-31T23:59:59Z] it works
>> fine
>>
>> Le 22/06/2012 10:51, Bruno Mannina a écrit :
>>
>>> Dear All,
>>>
>>> I have a standard field date in my docs like:
>>> 2005-02-05T23:59:59Z
>>> my field name is publication-date
>>>
>>> I would like to request docs (sorl admin) with only one specific year?
>>> I tried:
>>> patent-number:EP* AND title-en:airplane AND publication-date:[2010]
>>>
>>> without success :'(
>>>
>>> Note:
>>> patent-number:EP* AND title-en:airplane works fine.
>>>
>>> Any idea?
>>>
>>> thanks a lot,
>>> Bruno
>>>
>>>
>>>
>>>
>>
>>
>
>
>


Re: Request field date?

Posted by Bruno Mannina <bm...@free.fr>.
As my index is actually out :'( I can't test it but with your first 
method (wildcard) the possibility to search with range becomes
not possible. So I will pre-process my request with the standard date 
format field.

Little question: is it always necessary to write:
i.e. 2001-01-23T23:59:59Z
is exist a field date without using the T....Z ?
I mean, I want to write in the <field name="pub-date">2001-01-23</field>

Thx !

PS: I'm always waiting help for my index corrupted, nobody can help me ?


Le 24/06/2012 00:46, Jack Krupansky a écrit :
> Or do a copyField to a "string" field and do a prefix wildcard query 
> using the year: publication-date_s:2010*.
>
> If you are using the LucidWorks Enterprise product, their query parser 
> understands date fields and you can simply type: publication-date:2010
>
> -- Jack Krupansky
>
> -----Original Message----- From: Erick Erickson
> Sent: Friday, June 22, 2012 11:09 AM
> To: solr-user@lucene.apache.org
> Subject: Re: Request field date?
>
> You're a bit stuck, Solr doesn't really recognize partial dates like 
> you want.
>
> What you can do, though, is just create an additional int field for
> year in this case
> and query on that.
>
> Best
> Erick
>
> On Fri, Jun 22, 2012 at 5:07 AM, Bruno Mannina <bm...@free.fr> wrote:
>> Precision:
>> I would like to write something like: [2010*]
>> If I write
>> publication-date:[2010-01-01T23:59:59Z TO 2010-12-31T23:59:59Z] it works
>> fine
>>
>> Le 22/06/2012 10:51, Bruno Mannina a écrit :
>>
>>> Dear All,
>>>
>>> I have a standard field date in my docs like:
>>> 2005-02-05T23:59:59Z
>>> my field name is publication-date
>>>
>>> I would like to request docs (sorl admin) with only one specific year?
>>> I tried:
>>> patent-number:EP* AND title-en:airplane AND publication-date:[2010]
>>>
>>> without success :'(
>>>
>>> Note:
>>> patent-number:EP* AND title-en:airplane works fine.
>>>
>>> Any idea?
>>>
>>> thanks a lot,
>>> Bruno
>>>
>>>
>>>
>>>
>>
>>
>
>
>



Re: Request field date?

Posted by Jack Krupansky <ja...@basetechnology.com>.
Or do a copyField to a "string" field and do a prefix wildcard query using 
the year: publication-date_s:2010*.

If you are using the LucidWorks Enterprise product, their query parser 
understands date fields and you can simply type:  publication-date:2010

-- Jack Krupansky

-----Original Message----- 
From: Erick Erickson
Sent: Friday, June 22, 2012 11:09 AM
To: solr-user@lucene.apache.org
Subject: Re: Request field date?

You're a bit stuck, Solr doesn't really recognize partial dates like you 
want.

What you can do, though, is just create an additional int field for
year in this case
and query on that.

Best
Erick

On Fri, Jun 22, 2012 at 5:07 AM, Bruno Mannina <bm...@free.fr> wrote:
> Precision:
> I would like to write something like: [2010*]
> If I write
> publication-date:[2010-01-01T23:59:59Z TO 2010-12-31T23:59:59Z] it works
> fine
>
> Le 22/06/2012 10:51, Bruno Mannina a écrit :
>
>> Dear All,
>>
>> I have a standard field date in my docs like:
>> 2005-02-05T23:59:59Z
>> my field name is publication-date
>>
>> I would like to request docs (sorl admin) with only one specific year?
>> I tried:
>> patent-number:EP* AND title-en:airplane AND publication-date:[2010]
>>
>> without success :'(
>>
>> Note:
>> patent-number:EP* AND title-en:airplane works fine.
>>
>> Any idea?
>>
>> thanks a lot,
>> Bruno
>>
>>
>>
>>
>
> 


Re: Request field date?

Posted by Erick Erickson <er...@gmail.com>.
You're a bit stuck, Solr doesn't really recognize partial dates like you want.

What you can do, though, is just create an additional int field for
year in this case
and query on that.

Best
Erick

On Fri, Jun 22, 2012 at 5:07 AM, Bruno Mannina <bm...@free.fr> wrote:
> Precision:
> I would like to write something like: [2010*]
> If I write
> publication-date:[2010-01-01T23:59:59Z TO 2010-12-31T23:59:59Z] it works
> fine
>
> Le 22/06/2012 10:51, Bruno Mannina a écrit :
>
>> Dear All,
>>
>> I have a standard field date in my docs like:
>> 2005-02-05T23:59:59Z
>> my field name is publication-date
>>
>> I would like to request docs (sorl admin) with only one specific year?
>> I tried:
>> patent-number:EP* AND title-en:airplane AND publication-date:[2010]
>>
>> without success :'(
>>
>> Note:
>> patent-number:EP* AND title-en:airplane works fine.
>>
>> Any idea?
>>
>> thanks a lot,
>> Bruno
>>
>>
>>
>>
>
>

Re: Request field date?

Posted by Bruno Mannina <bm...@free.fr>.
Precision:
I would like to write something like: [2010*]
If I write
publication-date:[2010-01-01T23:59:59Z TO 2010-12-31T23:59:59Z] it works 
fine

Le 22/06/2012 10:51, Bruno Mannina a écrit :
> Dear All,
>
> I have a standard field date in my docs like:
> 2005-02-05T23:59:59Z
> my field name is publication-date
>
> I would like to request docs (sorl admin) with only one specific year?
> I tried:
> patent-number:EP* AND title-en:airplane AND publication-date:[2010]
>
> without success :'(
>
> Note:
> patent-number:EP* AND title-en:airplane works fine.
>
> Any idea?
>
> thanks a lot,
> Bruno
>
>
>
>