开发者

Issue with Haystack/Whoosh SearchQuerySet's order_by

I define an index as shown below, zero-padding the order_key integerfield as specified in the doc.

class PlaceIndex(SearchIndex):
    text = CharField(document=True, use_template=True)
    order_key = Integer开发者_运维技巧Field(model_attr='order_key')

    def prepare_order_key(self, obj):
        return '%08d' % obj.order_key

site.register(Place, PlaceIndex)

When I run python manage.py rebuild_index, I can order_by my SearchQuerySet properly, but as soon as I run python manage.py update_index, a SearchQuerySet with an order_by always returns an empty list.

What's wrong?

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜