Home:ALL Converter>Django-haystack with whoosh

Django-haystack with whoosh

Ask Time:2011-11-07T20:47:30         Author:Cadilac

Json Formatter

I am getting SearchBackendError at /forum/search/ No fields were found in any search_indexes. Please correct this before attempting to search.

with search_indexes placed in djangobb app root directory:

from haystack.indexes import *
from haystack import site

import djangobb_forum.models as models

class PostIndex(RealTimeSearchIndex):
    text = CharField(document=True, use_template=True)
    author = CharField(model_attr='user')
    created = DateTimeField(model_attr='created')
    topic = CharField(model_attr='topic')
    category = CharField(model_attr='topic__forum__category__name')
    forum = IntegerField(model_attr='topic__forum__pk')

site.register(models.Post, PostIndex)

settings.py

# Haystack settings 

HAYSTACK_SITECONF = 'search_sites'
HAYSTACK_SEARCH_ENGINE = 'whoosh'
HAYSTACK_WHOOSH_PATH = os.path.join(PROJECT_ROOT, 'djangobb_index')

also i havae haystack and whoosh in my installed apps.
In python interpreter:

>>> import haystack
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/.../lib/python2.7/django_haystack-1.2.5-py2.5.egg/haystack/__init__.py", line 26, in <module>
    raise ImproperlyConfigured("You must define the HAYSTACK_SITECONF setting before using the search framework.")
django.core.exceptions.ImproperlyConfigured: You must define the HAYSTACK_SITECONF setting before using the search framework.

Has someone has any ideas? Thanks in advance for any help you might have to offer.

Author:Cadilac,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/8036715/django-haystack-with-whoosh
yy