django 排序
Unfortunately, the django-sphinx module is not very thoroughly documented. One thing which I could not figure out is how to do sorting. I thought that I had to set some kind of keyword argument on the SphinxSearch instance… (I have to admit though that the sorting is indeed demonstrated in the project README.rst, I simply overlooked it…)
不幸的是, django-sphinx模块没有得到充分的记录。 我不知道的一件事是如何进行排序。 我以为我必须在SphinxSearch实例上设置某种关键字参数…(我必须承认,尽管排序确实在项目README.rst中得到了证明,但我只是忽略了它……)
But the solution was much simpler – you can use order_by directly on the SphinxSearch instance.
但是解决方案要简单得多–您可以直接在SphinxSearch实例上使用order_by 。
ModelModel .. searchsearch .. queryquery (( 'spam''spam' )) .. order_byorder_by (( '-amount''-amount' )
)
翻译自: https://www.pybloggers.com/2011/12/django-sphinx-sorting/
django 排序