tags:

views:

39

answers:

1

I am trying to implement search with Django haystack and solr, but I get this error when trying to implement faceted searching on a SearchIndex and then trying to run the server:

TypeError: init() got an unexpected keyword argument 'faceted'

Here is the SearchIndex:

import datetime
from haystack.indexes import *
from haystack import site
from resources.models import Resource

class ResourceIndex(SearchIndex):
    text = CharField(document=True, use_template=True)
    author = CharField(model_attr='submitter', faceted=True)
    pub_date = DateTimeField(model_attr='created')

    def get_queryset(self):
        """Used when the entire index for model is updated."""
        return Resource.objects.filter(last_modified__lte=datetime.datetime.now())

site.register(Resource, ResourceIndex)
+1  A: 

If you installed haystack using easy_install or pip, you got version 1.01 and that apparently doesn't support the "faceted" keyword argument on haystack.indexes.CharField.

From Daniel Lindsley: faceted equals true thread

You'll have to install git master version instead of the 1.01 release provided in PyPi (which easy_install and pip will install by default)

Evan Porter