3

Python 2.5、Django 1.2.1、最新のヘイスタック、最新のシューッという音

これは、Django-Haystack を初めて掘り下げたものです。私は Haystack の「Getting Started」ガイドに従っていましたが、インデックスを作成するまではすべて順調に進んでいるように見えました。

したがって、「manage.py rebuild_index」を実行すると、これが返ってきました。

Traceback (most recent call last):
  File "/Users/steenb/Documents/Aptana Studio Workspace/bucksac/buckshr/manage.py", line 11, in <module>
    execute_manager(settings)
  File "/Library/Python/2.5/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/Library/Python/2.5/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.5/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Python/2.5/site-packages/django/core/management/base.py", line 218, in execute
    output = self.handle(*args, **options)
  File "/Library/Python/2.5/site-packages/haystack/management/commands/rebuild_index.py", line 13, in handle
    call_command('clear_index', **options)
  File "/Library/Python/2.5/site-packages/django/core/management/__init__.py", line 166, in call_command
    return klass.execute(*args, **defaults)
  File "/Library/Python/2.5/site-packages/django/core/management/base.py", line 218, in execute
    output = self.handle(*args, **options)
  File "/Library/Python/2.5/site-packages/haystack/management/commands/clear_index.py", line 38, in handle
    sb.clear()
  File "/Library/Python/2.5/site-packages/haystack/backends/whoosh_backend.py", line 212, in clear
    self.index.commit()
AttributeError: 'FileIndex' object has no attribute 'commit'

どこから始めればいいのかわからない... 誰かがこれに遭遇したことはありますか?

解決策について何か考えはありますか?

更新: python 2.6 でもこれを試してみましたが、同じエラーが発生しました。まだ行っていない Whoosh 設定はありますか?

更新: philippbosch からの以下の提案を使用した後、最初のエラーは表示されなくなりましたが、今はこれを取得しています:

Traceback (most recent call last):
  File "/Users/steenb/Documents/Aptana Studio Workspace/bucksac/buckshr/manage.py", line 11, in <module>
    execute_manager(settings)
  File "/Library/Python/2.5/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/Library/Python/2.5/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.5/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Python/2.5/site-packages/django/core/management/base.py", line 218, in execute
    output = self.handle(*args, **options)
  File "/Library/Python/2.5/site-packages/haystack/management/commands/update_index.py", line 69, in handle
    return super(Command, self).handle(*apps, **options)
  File "/Library/Python/2.5/site-packages/django/core/management/base.py", line 282, in handle
    app_output = self.handle_app(app, **options)
  File "/Library/Python/2.5/site-packages/haystack/management/commands/update_index.py", line 123, in handle_app
    index.backend.update(index, small_cache_qs[start:end])
  File "/Library/Python/2.5/site-packages/haystack/backends/whoosh_backend.py", line 163, in update
    writer = AsyncWriter(self.index.writer, postlimit=self.post_limit)
TypeError: __init__() got an unexpected keyword argument 'postlimit'

互換性のないバージョンのWhooshを使用しているかどうか疑問に思っています....最新の1.0.0b2を入手しました... http://pypi.python.org/pypi/Whoosh/

update : バージョンの問題であることがわかりました。現在、Haystack は whoosh 0.3.18 に関連付けられています。

4

3 に答える 3

6

私は今同じ問題を抱えていました。»rebuild_index« の代わりに »update_index« を試しましたか? それは私にとってうまくいくように見えました…</p>

于 2010-08-06T14:21:49.610 に答える
1

Whoosh 0.3.18をインストールすると、問題が解決しました

于 2011-05-29T13:01:12.983 に答える
0

インデックスからエントリを削除しようとしたときにこの質問が見つかった場合は、オブジェクトIndexWriterではなく を使用してエントリを削除する必要があるかもしれません。FileIndex例えば:

それ以外の:

ix = open_dir('index')
ix.delete_by_term('path', u'/a/b/c')
ix.commit()

上記のエラーがスローされる場合は、次を実行してファイルを削除できます。

ix = open_dir('index')
writer = ix.writer()
writer.delete_by_term('path', u'/a/b/c')
writer.commit()
于 2014-09-29T01:05:39.060 に答える