Django Haystack and Whoosh: no column exception when sorting -
i have userprofile search index, so:
class userprofileindex(searchindex, indexable): text = charfield(document=true, use_template=true) last_name = charfield(model_attr='last_name', indexed=true) country = charfield(model_attr='country') sectors = charfield(use_template=true) services = charfield(use_template=true) def get_model(self): return userprofile def index_queryset(self, using=none): """ used when entire index model updated.""" return self.get_model().public.all()
and trying sort last_name field using command:
s = searchqueryset().all().order_by('last_name')
i back:
exception: no column field 'last_name'
i have no problems doing filter on field.
s = searchqueryset().filter(last_name='smith')
works fine.
i'm guessing whoosh issue, can't seem find work around.
not sure if you've solved sake of else comes across this, had same issue , figured out.
if use order_by on field in haystack , whoosh back-end, field ordering must exist on of indexes. not 1 you're interested in. filter doesn't suffer same requirement, why query goes through.
Comments
Post a Comment