Hi,
I have an index with a MultiValueField that holds a m2m field ids.
Given a category id how can I have a SearchQuerySet that consist of
- all the models that matches the category id
- all the models that have empty categories
class MyIndex(indexes.SearchIndex):
text = indexes.CharField(document=True, use_template=True)
categories = indexes.MultiValueField()
def prepare_categories(self, obj):
return [
category.id for category in obj.categories.all()]
p.s. do I need to add indexed=False and stored=True to the categories
field?
Thanks
--
You received this message because you are subscribed to the Google Groups "django-haystack" group.
To post to this group, send email to
django-...@googlegroups.com.
To unsubscribe from this group, send email to
django-haysta...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-haystack?hl=en.