matching on month
Hi, I am trying to return results based on the month of a date field, Is this possible. I know I can do ranges using the field:[date TO date] but now I have a requirement to return records based on just the month part of a date so if I have record with these dates and search on the May/05 date name=*effDate_tdt*2011-05-01T00:00:00Z/date date name=*effDate_tdt*2006-05-01T00:00:00Z/date date name=*effDate_tdt*2004-05-01T00:00:00Z/date date name=*effDate_tdt*1995-07-01T00:00:00Z/date the query would only return these date name=*effDate_tdt*2011-05-017T00:00:00Z/date date name=*effDate_tdt*2006-05-30T00:00:00Z/date date name=*effDate_tdt*2004-05-03T00:00:00Z/date
Re: matching on month
Hi Don, You can try date name=*effDate_tdt*2011-05-01T00:00:00Z TO 2011-05-30T00:00:00Z/date date name=*effDate_tdt*2006-05-01T00:00:00Z TO 2006-05-30T00:00:00Z/date And so on. I am not sure if month query is available, probably other group members can shed more light on the same. But this can be used as quick fix. -param On 1/5/12 9:41 AM, Don Hill justj...@gmail.com wrote: Hi, I am trying to return results based on the month of a date field, Is this possible. I know I can do ranges using the field:[date TO date] but now I have a requirement to return records based on just the month part of a date so if I have record with these dates and search on the May/05 date name=*effDate_tdt*2011-05-01T00:00:00Z/date date name=*effDate_tdt*2006-05-01T00:00:00Z/date date name=*effDate_tdt*2004-05-01T00:00:00Z/date date name=*effDate_tdt*1995-07-01T00:00:00Z/date the query would only return these date name=*effDate_tdt*2011-05-017T00:00:00Z/date date name=*effDate_tdt*2006-05-30T00:00:00Z/date date name=*effDate_tdt*2004-05-03T00:00:00Z/date
Re: matching on month
The query would actually look like fq=effDate_tdt:[2011-05-01T00:00:00Z TO 2011-05-31T00:00:00Z] and you need to be a little careful with the end date, this would actually skip documents on 31 May, you'd need to do something like: fq=effDate_tdt:[2011-05-01T00:00:00Z TO 2011-05-31T23:59:59:999Z] As of 4.0, you can mix inclusive/exclusive as q=effDate_tdt:[2011-05-01T00:00:00Z TO 2011-06-01T00:00:00Z} Best Erick On Thu, Jan 5, 2012 at 10:04 AM, Sethi, Parampreet parampreet.se...@teamaol.com wrote: Hi Don, You can try date name=*effDate_tdt*2011-05-01T00:00:00Z TO 2011-05-30T00:00:00Z/date date name=*effDate_tdt*2006-05-01T00:00:00Z TO 2006-05-30T00:00:00Z/date And so on. I am not sure if month query is available, probably other group members can shed more light on the same. But this can be used as quick fix. -param On 1/5/12 9:41 AM, Don Hill justj...@gmail.com wrote: Hi, I am trying to return results based on the month of a date field, Is this possible. I know I can do ranges using the field:[date TO date] but now I have a requirement to return records based on just the month part of a date so if I have record with these dates and search on the May/05 date name=*effDate_tdt*2011-05-01T00:00:00Z/date date name=*effDate_tdt*2006-05-01T00:00:00Z/date date name=*effDate_tdt*2004-05-01T00:00:00Z/date date name=*effDate_tdt*1995-07-01T00:00:00Z/date the query would only return these date name=*effDate_tdt*2011-05-017T00:00:00Z/date date name=*effDate_tdt*2006-05-30T00:00:00Z/date date name=*effDate_tdt*2004-05-03T00:00:00Z/date
Re: matching on month
: The query would actually look like : fq=effDate_tdt:[2011-05-01T00:00:00Z TO 2011-05-31T00:00:00Z] i think your overlooking part of the question ... Don seems to be asking how to query if the value of a date field contains a day in the month of may, regarldess of year... : the query would only return these : : date name=*effDate_tdt*2011-05-017T00:00:00Z/date : date name=*effDate_tdt*2006-05-30T00:00:00Z/date : date name=*effDate_tdt*2004-05-03T00:00:00Z/date ...this isn't possible with the solr date field. you'll need to create a special month field and index just the month value there. -Hoss