I am not getting whoosh facet_counts
to work with Haystack in my Django project:
Python==2.7.8
, Whoosh==2.7
, Haystack==2.3.1
.
I received the error "Warning: Whoosh does not handle faceting"
when I run the following:
In [1]: from haystack.query import SearchQuerySet
In [2]: sqs = SearchQuerySet().facet('title')
In [3]: sqs.facet_counts()
/Users/chriswedgwood/virtualenvs/omexchange/lib/python2.7/site-
packages/haystack/backends/init.py:35: Warning: Whoosh does not handle
faceting.
Out[3]: {}
In my search_indexes.py
, I have declared:
title = indexes.CharField(model_attr='title',faceted=True)
I thought I would change my backend to elastic search and see what happens and I got results back:
In [1]: from haystack.query import SearchQuerySet
In [2]: sqs = SearchQuerySet().facet('title')
In [3]: sqs.facet_counts()
Out[3]: {u'dates': {}, u'fields': {'title': [(u'Event vlugkppylj', 2),
(u'Event jlomvcpidn', 2), (u'Event ryusgjejgg', 1), (u'Event pjetthkihw', 1),
(u'Event jdeestsxpb', 1), (u'Event hkmuyhnzjv', 1), (u'Event ewnxnvisdj', 1),
(u'Chris event', 1)]}, u'queries': {}}
I'm a bit confused with the combination of the Haystack documents and the whoosh documents.
Do I need to define a schema in order to get the faceting to function? Where should I do that? In search_indexes.py
?