How to customize date facets?

17 views
Skip to first unread message

@@

unread,
Nov 28, 2009, 11:06:41 AM11/28/09
to django-...@googlegroups.com
Sorry for asking so many questions :P

I tried to look into the source code, but didn't got any clue.
Is there any way to customize date facets my self?
for example:
Past hour
Past 24 hours
Past week
Past year

David Sauve

unread,
Nov 28, 2009, 11:19:14 AM11/28/09
to django-...@googlegroups.com
It think you want to have a look at this page: http://haystacksearch.org/docs/searchqueryset_api.html#date-facet

If you want to see how this works in code, the Xapian backend tests might shed some light on it.  Line #230 in xapian_tests/tests/xapian_backend.py

--

You received this message because you are subscribed to the Google Groups "django-haystack" group.
To post to this group, send email to django-...@googlegroups.com.
To unsubscribe from this group, send email to django-haysta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-haystack?hl=en.

@@

unread,
Nov 28, 2009, 11:46:06 AM11/28/09
to django-...@googlegroups.com
Hi Diavid,
Thanks for the quick reply :)
I've looked the api document, i thought i may haven't make my question clear.
It seems that the gap is fixed according to the document.
However what i want is not a equal difference date list but a customized date list.
As the previous example. 

Past hour
Past 24 hours
Past week
Past year

the start date is current date - 1 hour, no end date.  But the gap is not fixed, the first two is 23 hours, the second two is 6 days the last tow is about 358 days. 
What i'm looking for is a method that i can direct pass a list of all those facets date.

I hope i've made my self clear :)


Daniel Lindsley

unread,
Nov 30, 2009, 10:15:11 PM11/30/09
to django-...@googlegroups.com
Askfor,


For the purposes of the mailing list (though you already know this
answer), my current recommended solution in this situation can be seen
at http://github.com/toastdriven/django-haystack/issues#issue/140/comment/82513.
In essence, we're limited by what the engines can do, so I'd recommend
using three regular ``SearchQuerySet``s instead and using ``.count()``
on them to simulate the faceting information.


Daniel
Reply all
Reply to author
Forward
0 new messages