如果在后台启用了Sphinx,需要在定时任务中添加更新索引任务
索引配置文件名称csft.conf ,存放路径/usr/local/coreseek/etc/csft.conf
配置内容如下
source doc
{
type = mysql
sql_host = localhost
sql_user = 111222
sql_pass = 111222
sql_db = 333333
sql_port = 3306
sql_sock = /tmp/mysql.sock
sql_query_pre = SET NAMES utf8
sql_query_pre = SET SESSION query_cache_type=OFF
sql_query = SELECT * FROM wz_doc_real where status=1 and is_delete=0 and id>=$start AND id<=$end
sql_field_string = title
sql_field_string = keywords
sql_field_string = tags
sql_field_string = description
sql_attr_string = doc_ids
sql_attr_string = ext
sql_attr_uint = doc_type
sql_attr_uint = views
sql_attr_uint = stars
sql_attr_uint = downs
sql_attr_uint = download_price
sql_attr_timestamp = create_time
sql_query_range = SELECT MIN(id),MAX(id) FROM wz_doc_real
sql_range_step = 5000
sql_ranged_throttle = 100
}
index attr_doc
{
source = doc
path = /usr/local/coreseek/var/data/attr_doc
docinfo = extern
mlock = 0
morphology = none
min_word_len = 1
charset_type = zh_cn.utf-8
charset_dictpath = /usr/local/mmseg/etc/
html_strip = 0
}
source news
{
type = mysql
sql_host = localhost
sql_user = 111222
sql_pass = 111222
sql_db = 333333
sql_port = 3306
sql_sock = /tmp/mysql.sock
sql_query_pre = SET NAMES utf8
sql_query_pre = SET SESSION query_cache_type=OFF
sql_query = SELECT * FROM wz_news where status=1 and is_delete=0
sql_field_string = title
sql_field_string = keywords
sql_field_string = description
sql_attr_uint = views
sql_attr_uint = digs
sql_attr_timestamp = create_time
sql_ranged_throttle = 0
}
index attr_news
{
source = news
path = /usr/local/coreseek/var/data/attr_news
docinfo = extern
mlock = 0
morphology = none
min_word_len = 1
charset_type = zh_cn.utf-8
charset_dictpath = /usr/local/mmseg/etc/
html_strip = 0
}
source goods
{
type = mysql
sql_host = localhost
sql_user = 111222
sql_pass = 111222
sql_db = 333333
sql_port = 3306
sql_sock = /tmp/mysql.sock
sql_query_pre = SET NAMES utf8
sql_query_pre = SET SESSION query_cache_type=OFF
sql_query = SELECT * FROM wz_shopping_goods where status=1 and is_del=0 and disabled=0
sql_field_string = title
sql_field_string = sub_title
sql_attr_uint = views
sql_attr_uint = favors
sql_attr_uint = sales
sql_attr_uint = goods_index
sql_attr_uint = is_new
sql_attr_uint = is_hot
sql_attr_uint = is_recommend
sql_attr_timestamp = create_time
sql_ranged_throttle = 0
}
index attr_goods
{
source = goods
path = /usr/local/coreseek/var/data/attr_goods
docinfo = extern
mlock = 0
morphology = none
min_word_len = 1
charset_type = zh_cn.utf-8
charset_dictpath = /usr/local/mmseg/etc/
html_strip = 0
}
indexer
{
mem_limit = 128M
}
searchd
{
listen = 9312
listen = 9306:mysql41
log = /usr/local/coreseek/var/log/searchd.log
query_log = /usr/local/coreseek/var/log/query.log
read_timeout = 5
client_timeout = 300
max_children = 30
pid_file = /usr/local/coreseek/var/log/searchd.pid
max_matches = 1000
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
mva_updates_pool = 1M
max_packet_size = 8M
max_filters = 256
max_filter_values = 4096
max_batch_queries = 32
}
上面的数据库账号,密码根据实际情况修改
添加任务:
/usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/csft.conf --stop
/usr/local/coreseek/bin/indexer --config /usr/local/coreseek/etc/csft.conf --all
/usr/local/coreseek/bin/searchd --config /usr/local/coreseek/etc/csft.conf
![](https://img.kancloud.cn/26/b5/26b5f00d8b35f771eac638a5fa51ade8_746x530.png)