Facets and date ranges

43 views
Skip to first unread message

jamescrowley

unread,
Jun 30, 2012, 5:34:13 AM6/30/12
to rav...@googlegroups.com
I'm playing around with the Facet functionality (awesome!) and was wondering how you might deal with a date based field. For instance, I envisage a range say "In the next 7 days", "In the next month" etc. Obviously however the actual date from which you're doing these calculations changes each day. Would you just create a scheduled job that re-creates the index each day with new date parameters?

What's the behaviour of indexes while they're being re-calculated? Would you need to create a new index while preserving the existing one to serve active queries and then replace once it's ready?

Or is this a "bad" idea?

Thanks!

Matt Warren

unread,
Jun 30, 2012, 11:53:03 AM6/30/12
to rav...@googlegroups.com
See below


On Saturday, 30 June 2012 10:34:13 UTC+1, jamescrowley wrote:
I'm playing around with the Facet functionality (awesome!)

Glad you like it, it's turned out to be a really nice feature,
 
and was wondering how you might deal with a date based field. For instance, I envisage a range say "In the next 7 days", "In the next month" etc. Obviously however the actual date from which you're doing these calculations changes each day. Would you just create a scheduled job that re-creates the index each day with new date parameters?

All you need to do it change the facet doc once per day, so that it's ranges are updated with respect to the current day/month etc. You don't need to re-create the index, just the facet ranges. Facet search does a live query each time you call .ToFacet(), it doesn't rely on calculations in the background like map/reduce.
 
What's the behaviour of indexes while they're being re-calculated? Would you need to create a new index while preserving the existing one to serve active queries and then replace once it's ready?

Not needed, see above
 

James Crowley

unread,
Jul 2, 2012, 3:35:44 AM7/2/12
to rav...@googlegroups.com
Even better, thanks Matt.
Reply all
Reply to author
Forward
0 new messages