Sphinx - 按日期排序,而不是按 unix 时间戳排序
我需要查看仅按 unix 时间戳的日期部分排序的结果。我的数据库中已经有一个日期时间字段,我正在将其转换为 unixtimestamp 以与 sphinx 一起使用。
.conf 文件中的示例代码
SELECT id, deleted, posts, createdOn, publish, UNIX_TIMESTAMP(createdOn) as date1 , thread_title, first_post \
FROM posts
sql_attr_timestamp = date1
谢谢 伊姆兰
I need to view my results sorted by only the date part of the unix timestamp. I already have a datetime field in my database which I am converting to unixtimestamp for using with sphinx.
Sample Code In .conf file
SELECT id, deleted, posts, createdOn, publish, UNIX_TIMESTAMP(createdOn) as date1 , thread_title, first_post \
FROM posts
sql_attr_timestamp = date1
Thanking you
Imran
可以使用 SetSortMode 函数完成排序:
要按降序排序,请使用 SPH_SORT_ATTR_DESC。
Sorting can be done using SetSortMode function:
To sort by descending order use SPH_SORT_ATTR_DESC.