【问题标题】:Django Haystack migrate from xapian to whooshDjango Haystack 从 xapian 迁移到 whoosh
【发布时间】:2015-11-17 08:42:15
【问题描述】:

在升级 Django 和 haystack 后,我在使用 xapian 设置 haystack 时遇到问题,所以我切换到了 whoosh。我创建了一个空白文件夹/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'

【问题讨论】:

    标签: python django django-haystack whoosh


    【解决方案1】:

    我将using=None 添加到index_queryset 所以看起来像def index_queryset(self, using=None): 这修复了错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-26
      • 1970-01-01
      • 1970-01-01
      • 2023-03-31
      相关资源
      最近更新 更多