Question

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

Was it helpful?

Solution

I had the same problem just now. Did you try »update_index« instead of »rebuild_index«? That seemed to work for me …

OTHER TIPS

Installing Whoosh 0.3.18 solved the problem on my side

If you found this question while attempting to delete an entry from an index, you might need to use an IndexWriter to delete the entry, rather than a FileIndex object; e.g.:

Instead of:

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

which throws the error discussed above, you can delete a file by running:

ix = open_dir('index')
writer = ix.writer()
writer.delete_by_term('path', u'/a/b/c')
writer.commit()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top