Sphinx中的Delta指数并不总是100%更新

时间:2017-10-05 23:37:06

标签: mysql sphinx

几个月前我为一个项目设置了Sphinx。到目前为止,它已经完美运行,但最近我们已经索引了比以前更多的站点,因此有时候delta索引的更新比以前更大,并且由于某种原因这导致delta索引不更新完整索引。 我们有一个MySql数据库用于存储,我们实现了一个带有更新时间戳的MySQL检查。我们还创建了一个触发器,因此每次更新记录时,它都会更新时间戳。

这是Sphinx.conf 我想知道是否有人可以提出一些问题可以解决问题。

最诚挚的问候!

source main_index
    {
    type                    = mysql

    sql_host                = host
    sql_user                = xxxxxx
    sql_pass                = xxxxxx
    sql_db                  = xxxxxx
    sql_port                = 3306  # optional, default is 3306

    sql_query_pre        = SET @maxts := (SELECT NOW())
    sql_query_pre = SET NAMES utf8
    sql_query            = SELECT Id, Id id_st,Link,date_added1,UNIX_TIMESTAMP(date_added) AS date_added2,country,source,sec, title, description FROM Sites WHERE ts < @maxts

    sql_query_post       = REPLACE INTO sphinxcounters VALUES ('Sites_tmp', @maxts)

    sql_query_post_index = DELETE FROM sphinxcounters WHERE tablename = 'Sites'

    sql_query_post_index = UPDATE sphinxcounters SET tablename = 'Sites' WHERE tablename = 'Sites_tmp'

    sql_query_post_index = DELETE FROM sphinxklist WHERE ts < (SELECT maxts FROM sphinxcounters WHERE tablename = 'Sites')

    sql_field_string        = description
    sql_field_string        = title
    sql_attr_string         = country
    sql_attr_string         = source
    sql_attr_string         = Link
    sql_attr_string         = sec
    sql_attr_uint           = id_st
    sql_attr_string         = date_added1
    sql_attr_timestamp      = date_added2


    # Index attributes declaration ...
}

source delta_index : main_index
{

    sql_query_pre        = SET @maxts:= (SELECT maxts FROM sphinxcounters WHERE tablename='Sites')
    sql_query_pre = SET NAMES utf8
    sql_query            = SELECT Id, Id id_st,Link,date_added1,UNIX_TIMESTAMP(date_added) AS date_added2,country,source,sec, title, description FROM Sites WHERE ts < @maxts

    # Killlist : List of id's in the main index result set that we want to suppress.
    # In the following query we suppress deleted and updated rows from main index

    sql_query_killlist   = SELECT Id FROM Sites WHERE ts >= @maxts UNION SELECT id FROM sphinxklist

}

0 个答案:

没有答案