python 2.7 - Django haystack filter in search index -
i have search working fine on project. in models have boolean field named is_active
.
i want search occurs when is_active true, i've been testing without satisfatory response.
my search_indexes.py:
haystack.indexes import * haystack.sites import site core.models import anunciosolucao class anunciosolucaoindex(realtimesearchindex): text = charfield(document=true,use_template=true) site.register(anunciosolucao,anunciosolucaoindex)
that way works, bring me is_active == false
. thoughts?
there's method called read_queryset on searchindex api. had override this:
class anunciosolucaoindex(realtimesearchindex): text = charfield(document=true,use_template=true) def read_queryset(self): super(anunciosolucaoindex,self).read_queryset() return anunciosolucao.objects.filter(is_active=true)
Comments
Post a Comment