Django Haystack从xapian迁移到whoosh

时间:2015-11-17 08:42:16

标签: python django django-haystack whoosh

在升级Django和haystack之后,我遇到了使用xapian设置haystack的问题,所以我已经切换到嗖的一声。我创建了一个空文件夹/home/kbuzz/whoosh_index,但是当我尝试进行搜索时,它什么也没有返回。

设置。

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
        'PATH': '/home/kbuzz/whoosh_index',
    },
}

当我尝试运行./manage.py rebuild_index

  Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/home/kbuzz/webapps/kenyabuzz/lib/python2.7/Django-1.7.10-py2.7.egg/djan                                                                                        go/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/home/kbuzz/webapps/kenyabuzz/lib/python2.7/Django-1.7.10-py2.7.egg/djan                                                                                        go/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/kbuzz/webapps/kenyabuzz/lib/python2.7/Django-1.7.10-py2.7.egg/djan                                                                                        go/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/kbuzz/webapps/kenyabuzz/lib/python2.7/Django-1.7.10-py2.7.egg/djan                                                                                        go/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/home/kbuzz/lib/python2.7/haystack/management/commands/rebuild_index.py"                                                                                        , line 15, in handle
    call_command('update_index', **options)
  File "/home/kbuzz/webapps/kenyabuzz/lib/python2.7/Django-1.7.10-py2.7.egg/djan                                                                                        go/core/management/__init__.py", line 115, in call_command
    return klass.execute(*args, **defaults)
  File "/home/kbuzz/webapps/kenyabuzz/lib/python2.7/Django-1.7.10-py2.7.egg/djan                                                                                        go/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/home/kbuzz/lib/python2.7/haystack/management/commands/update_index.py",                                                                                         line 184, in handle
    return super(Command, self).handle(*items, **options)
  File "/home/kbuzz/webapps/kenyabuzz/lib/python2.7/Django-1.7.10-py2.7.egg/djan                                                                                        go/core/management/base.py", line 503, in handle
    label_output = self.handle_label(label, **options)
  File "/home/kbuzz/lib/python2.7/haystack/management/commands/update_index.py",                                                                                         line 210, in handle_label
    self.update_backend(label, using)
  File "/home/kbuzz/lib/python2.7/haystack/management/commands/update_index.py",                                                                                         line 239, in update_backend
    end_date=self.end_date)
  File "/home/kbuzz/lib/python2.7/haystack/indexes.py", line 165, in build_query                                                                                        set
    index_qs = self.index_queryset(using=using)
TypeError: index_queryset() got an unexpected keyword argument 'using'

1 个答案:

答案 0 :(得分:1)

我已将using=None添加到index_queryset,所以看起来def index_queryset(self, using=None):这样可以解决错误。