views:

99

answers:

1

I have implemented django-sphinx search in my website. I need result set "order by end_time" but i got results oder by first "id" and then "end_time".

My conf is: 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 }

And my view model_results = model.search.query(keyword,stype).order_by('-end_time')

Can anyone help me in sorting out this problem.............

A: 

Try changing your config so it has UNIX_TIMESTAMP(end_time) as end_time, reindexing, restarting searchd, and testing after that.

mlissner