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 solrquestion6 <ba...@yahoo.com> on 2010/01/26 00:14:31 UTC

date math help

If I wanted to return documents faceted by LastMod and I wanted them grouped
by week what would the correct syntax be?

I would like to eventually format the results to display this:

Last day (facet count)
Last Week (facet count)
Last 2 Weeks (facet count)
Last Month (facet count)
Last 2 Months (facet count)
Last 3 Months (facet count)

So I figured I can get a date facet results going back 3 months in 7 day
increments then map the results to my desired format.

facet=true
facet.date=LastMod
f.LastMod.facet.date.end=NOW/DAY+1DAY
f.LastMod.facet.date.gap=+7DAYS
f.LastMod.facet.date.start=NOW/DAY-84DAYS

(84 days is 12 weeks)

Am I going about this wrong or is there a better way to get my desired
result?


thanks!


-- 
View this message in context: http://old.nabble.com/date-math-help-tp27315500p27315500.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: date math help

Posted by Ahmet Arslan <io...@yahoo.com>.

---
> What not use separate facet query for each these? 
> &facet.query:[NOW-1DAY TO
> NOW]&facet.query:[NOW-7DAYS TO NOW]& etc.

Sorry I forgot to add the field name:

&facet.query=LastMod:[NOW-1DAY TO NOW]&facet.query=LastMod:[NOW-7DAYS TO NOW]&


      

Re: date math help

Posted by Ahmet Arslan <io...@yahoo.com>.
> If I wanted to return documents faceted by LastMod and I
> wanted them grouped
> by week what would the correct syntax be?
> 
> I would like to eventually format the results to display
> this:
> 
> Last day (facet count)
> Last Week (facet count)
> Last 2 Weeks (facet count)
> Last Month (facet count)
> Last 2 Months (facet count)
> Last 3 Months (facet count)

What not use separate facet query for each these? 
&facet.query:[NOW-1DAY TO NOW]&facet.query:[NOW-7DAYS TO NOW]& etc.