V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
foonpcf
V2EX  ›  Django

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

  •  
  •   foonpcf · 2013 年 8 月 28 日 · 4104 次点击
    这是一个创建于 4537 天前的主题,其中的信息可能已经有所发展或是发生改变。
    8 条回复    1970-01-01 08:00:00 +08:00
    zhuf
        1
    zhuf  
       2013 年 8 月 28 日   ❤️ 1
    foonpcf
        2
    foonpcf  
    OP
       2013 年 8 月 28 日
    @zhuf, 當我python manage.py rebuild_index後出現這個情況“TypeError: coercing to Unicode: need string or buffer, tuple found“
    zhuf
        3
    zhuf  
       2013 年 8 月 28 日
    @foonpcf 具体代码贴下
    foonpcf
        4
    foonpcf  
    OP
       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
        5
    zhuf  
       2013 年 8 月 28 日   ❤️ 1
    @foonpcf 我记得文档里应该是这样的吧
    ```import os
    HAYSTACK_CONNECTIONS = {
    'default': {
    'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
    'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
    },
    }```
    zhuf
        6
    zhuf  
       2013 年 8 月 28 日   ❤️ 1
    还有检查下haystack的版本,好像版本不对是有问题的。
    foonpcf
        7
    foonpcf  
    OP
       2013 年 8 月 28 日
    版本是django-haystack 1.2.7
    foonpcf
        8
    foonpcf  
    OP
       2013 年 8 月 29 日
    @zhuf, 我重新用你的教學做多一次,但得不到結搜尋結果....... =(
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1156 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:32 · PVG 07:32 · LAX 15:32 · JFK 18:32
    ♥ Do have faith in what you're doing.