Facet_count无法使用Whoosh后端

时间:2015-04-18 13:31:47

标签: python django django-haystack whoosh

在我的Django项目中,我没有和Haystack一起工作facet_countsPython==2.7.8Whoosh==2.7Haystack==2.3.1

运行以下内容时收到错误"Warning: Whoosh does not handle faceting"

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]: {}

在我的search_indexes.py中,我宣布:

title = indexes.CharField(model_attr='title',faceted=True)

我以为我会将后端改为弹性搜索,看看会发生什么 我得到了结果:

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': {}}

我对Haystack文档和嗖嗖声文件的组合感到有些困惑。

我是否需要定义架构才能使分面发挥作用?我该怎么办?在search_indexes.py

0 个答案:

没有答案