python - Filter blank CharField in Django Haystack's SearchQuerySet -
i need return entries in searchqueryset charfield blank i.e. empty string.
in search_indexes.py have:
sometext = indexes.charfield(model_attr='sometext')
i've tried filtering using usual sqs syntax:
searchqueryset().filter(sometext__exact='') searchqueryset().filter(sometext__in=['', none])
neither return blank entries. first returns entries, second returns none @ all.
am missing in searchindex definitions? there way can done in haystack using whoosh backend?
try this, works me:
from haystack.inputs import raw r = searchqueryset() r.exclude(sometext=raw('*'))