Thank you for your great suggestion. That worked! A follow-up: We're using this 
to do partial date searches on the copyField text field, providing month "08" 
and day "01":

        date_text:08* AND date_text:01*

It returns the results correctly, but is there a more efficient way to do this? 
Thanks.

Warm regards,
Alex 

-----Original Message-----
From: Jack Krupansky [mailto:j...@basetechnology.com] 
Sent: 13 September 2012 4:47 PM
To: solr-user@lucene.apache.org
Subject: Re: Partial date searches

Wildcard patterns work on dates if they are "string" fields.

If your dates are "trie" dates (the default "date" field type now), you would 
need to do a copyField to a string field to do the wildcard match.

Examples:

    ????-05-12*
    2010-??-12*

-- Jack Krupansky

-----Original Message-----
From: Alex Cougarman
Sent: Thursday, September 13, 2012 9:03 AM
To: solr-user@lucene.apache.org
Subject: Partial date searches

Hi. We're using Solr 4.0Beta and wondered how we can perform partial date 
searches. For example, we have this date stored in the index:

   <date name="my_date">2010-05-12T00:00:00Z</date>

The user may want to search on all documents from 05-12 without providing the 
year. Or the user may want to search on 2010-xx-12 where the day isn't known 
but the month and year are known. Is this possible? Is there a sample search we 
can run in the admin interface against our index? Thanks.

Warm regards,
Alex Cougarman

Bahá'í World Centre
Haifa, Israel
Office: +972-4-835-8683
Cell: +972-54-241-4742
acoug...@bwc.org 

Reply via email to