Home:ALL Converter>Django-Haystack/Whoosh - Rebuild Index Error

Django-Haystack/Whoosh - Rebuild Index Error

Ask Time:2010-08-06T21:17:27         Author:Brant

Json Formatter

Python 2.5, Django 1.2.1, most recent haystack, most recent whoosh

This is my first delve into Django-Haystack. I was following the "Getting Started" guide from Haystack and everything seemed to be going along fine, until I went to build the index.

So, running "manage.py rebuild_index" shot this back at me:

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'

Not sure even where to start with this... has anyone run into this before?

Any thoughts on a solution?

Update: Tried this with python 2.6 as well, got the same error. Is there some Whoosh configuration that I have not done?

Update: After using the below suggestion from philippbosch, the first error didn't show up anymore but now I am getting this:

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'

I am wondering if I am using an incompatable version of Whoosh.... I grabbed the latest which is 1.0.0b2 ... http://pypi.python.org/pypi/Whoosh/

update: Turns out it is a version problem. Currently, Haystack is tied to whoosh 0.3.18

Author:Brant,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/3424098/django-haystack-whoosh-rebuild-index-error
philippbosch :

I had the same problem just now. Did you try »update_index« instead of »rebuild_index«? That seemed to work for me …",
2010-08-06T14:21:49
Nicu Surdu :

Installing Whoosh 0.3.18 solved the problem on my side",
2011-05-29T13:01:12
yy