我已经在我的网站中实现了 django-sphinx 搜索。我需要结果集"order by end_time"但我得到的结果是先 "id" 然后 "end_time"。
我的conf是:
source main_event : main_civilengagement
{
sql_query = \
SELECT mc.id as id, mc.name as name, tt.name as ttname, mp.text as mptext, \
mc.description as description, mc.meta_search as meta_search, \
mc.start_time as start_time, mc.end_time as end_time \
FROM main_event mc LEFT JOIN \
(tagging_taggeditem tti JOIN tagging_tag tt on tti.tag_id=tt.id) \
on mc.id=tti.object_id and \
tti.content_type_id=(select id from \
django_content_type where name='event' \
and app_label='main') \
LEFT JOIN main_post mp on mc.id=mp.object_id \
and mp.content_type_id= \
(select id from \
django_content_type where name='event' \
and app_label='main')
# DateField's and DateTimeField's
sql_attr_timestamp = start_time
sql_attr_timestamp = end_time
}
index main_event : main_civilengagement
{
source = main_event
path = ../../../sphinx/data/main_event_damco
}
而我的看法
model_results = model.search.query(keyword,stype).order_by('-end_time')
谁能帮我解决这个问题............