Answer the question
In order to leave comments, you need to log in
Faceted search not working, whoosh + haystack?
Good afternoon. I made a bunch of whoosh + haystack, faceted search does not work.
In the file search_indexes.py I write:
from haystack import indexes
from product.models import Blog
class BlogIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True,
template_name='search/indexes/blog/blog_text.txt')
title = indexes.CharField(model_attr='title', faceted=True)
author= indexes.CharField(model_attr='author', faceted=True)
def get_model(self):
return Blog
def index_queryset(self, using=None):
return self.get_model().objects.all()
>>> from haystack.query import SearchQuerySet
>>> sqs = SearchQuerySet().facet('author')
>>> sqs.facet_counts()
{}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question