2009-12-29 35 views
0

我在我的網站中實現了django-sphinx搜索。 我需要結果集「order by end_time」但我得到的結果或先「id」,然後「end_time」django獅身人面像中的order_by

我的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') 

誰能幫我整理出這個問題............

回答

0

嘗試更改您的配置,使其具有UNIX_TIMESTAMP(end_time)作爲end_time,重新編制索引,重新啓動searchd,然後進行測試這一點。