Sphinx 索引日期时间字段不正确

Sphinx indexes datetime field incorrectly

我是运行 PostgreSQL 数据库。我有一个 table,其中包含一个没有时区类型的时间戳字段。

我用 Sphinx 索引这个 table,这是我的 config.txt 的部分:

source ad: base
{
sql_query_range = SELECT MIN(id), MAX(id) FROM ad
sql_range_step = 1000
sql_query =\
    SELECT ad.id, \
           ad.title, \
           ad.category, \
           ad.subcategory, \
           ad.price, \
           ad.currency, \
           ad.url, \
           ad.photo_urls, \
           ad.city AS location, \
           ad.ad_id, \
           ad.date \
    FROM ad \
    WHERE ad.id BETWEEN $start AND $end

sql_field_string = title
sql_attr_uint = category
sql_attr_uint = subcategory
sql_attr_uint = location
sql_attr_uint = price
sql_attr_string = url
sql_attr_string = ad_id
sql_attr_string = photo_urls
sql_attr_multi = uint filtr from query; \
        SELECT ad_id, filter_value_id \
        from ad_filter_value_list
sql_attr_timestamp = date
}

但在索引 table 中,字段 date 仅包含年份值,即“2015”,而不是完整日期。哪里会出错?

Sphinxes 时间戳属性类型是一个(无符号)整数。真的和sql_attr_uint在功能上没什么区别。

它用于处理纯整数的 unix 时间戳。

在 mysql 中有一个 UNIX_TIMESTAMP() 函数可以将本机日期类型转换为 unix 时间戳。希望 PostgreSQL 有类似的东西。看起来像 extract() 函数? https://dba.stackexchange.com/questions/2796/how-do-i-get-the-current-unix-timestamp-from-postgresql