I am attempting to setup a search function on my django site using django-haystack with xapian backend. I followed the directions as per: http://django-haystack.readthedocs.org/en/latest/tutorial.html
When I enter a search it throws the error: Unable to open index at search/xapian/xapian_index
It seems that no search index was created when I ran ./manage.py rebuild_index However, no errors were reported at that time.
I am attempting to index the following model in myapp/models.py:
class MyMsg (models.Model):
msg = models.TextField(max_length=2000)
pub_date = models.DateTimeField('date published')
author = models.ForeignKey(User)
def __unicode__(self):
return self.msg
I have the following search index in myapp/search_index.py:
class MyMsgIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
author = indexes.CharField(model_attr='author')
pub_date = indexes.DateTimeField(model_attr='pub_date')
def get_model(self):
return MyMsg
def index_queryset(self):
"""Used when the entire index for model is updated."""
return self.get_model().objects.filter(pub_date__lte=datetime.datetime.now())
I am using: haystack 1.2.4 xapian 1.2.12 mac OS X 10.6.8
Thanks in advance for you help.