Skip to content
notanumber edited this page Sep 13, 2010 · 1 revision

Most faceting will work as described in the Haystack documentation with the exception of date_facet.

xapian-haystack employs a custom format for the gap parameter where gap is a string with a unit of time and optional value seperated by an ‘=’ operator.

For example:


# Facet every seven days
SearchQuerySet().filter(content='foo').date_facet('pub_date', start_date=datetime.date(2009, 6, 7), end_date=datetime.date(2009, 7, 7), gap='days=7')

or


# Facet every month
SearchQuerySet().filter(content='foo').date_facet('pub_date', start_date=datetime.date(2009, 6, 7), end_date=datetime.date(2009, 7, 7), gap='month')

The gap can be any one of the following:

  • year
  • years
  • month
  • months
  • day
  • days
  • hour
  • hours
  • minute
  • minutes
  • second
  • seconds