請問怎樣使用Django-haystack作搜尋器?

2013 年 8 月 28 日
 foonpcf
4346 次点击
所在节点    Django
8 条回复
zhuf
2013 年 8 月 28 日
foonpcf
2013 年 8 月 28 日
@zhuf, 當我python manage.py rebuild_index後出現這個情況“TypeError: coercing to Unicode: need string or buffer, tuple found“
zhuf
2013 年 8 月 28 日
@foonpcf 具体代码贴下
foonpcf
2013 年 8 月 28 日
我是用Django-cms及django-cms-search, 需要倚賴Django-haystack

settings.py

HAYSTACK_SEARCH_ENGINE = 'whoosh'

HAYSTACK_WHOOSH_PATH = os.path.join(os.path.dirname(__file__), 'whoosh_index'),

HAYSTACK_SITECONF = 'cmsplugin_search.search_indexes'
zhuf
2013 年 8 月 28 日
@foonpcf 我记得文档里应该是这样的吧
```import os
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
},
}```
zhuf
2013 年 8 月 28 日
还有检查下haystack的版本,好像版本不对是有问题的。
foonpcf
2013 年 8 月 28 日
版本是django-haystack 1.2.7
foonpcf
2013 年 8 月 29 日
@zhuf, 我重新用你的教學做多一次,但得不到結搜尋結果....... =(

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://v2ex.xtra.eu.org/t/80524

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX