php linux sphinx 命令和建立索引
<br />建立server<br />searchd --install --config d:/csft/bin/csft.conf<br />searchd --delete<br />searchd -h<br />必须手动启动服务<br /> <br />建立索引 (document为索引名称)<br />indexer --config d:/csft/bin/csft.conf do
建立server
searchd --install --config d:/csft/bin/csft.conf
searchd --delete
searchd -h
必须手动启动服务
建立索引 (document为索引名称)
indexer --config d:/csft/bin/csft.conf document
如果建立的server开启了,用在建立索引的时候在后面加上:
indexer --config d:/csft/bin/csft.conf document --rotate
合并索引 --merge后面为两个索引名,并且它们都建立好了
indexer --merge dtcontent dtcontentAdd --rotate
建立词库:
mmseg -u d:/csft/unigram.txt
然后将生成好的unigram.txt.uni文件修改为uni.lib,然后将修改之后
的文件放到你在配置索引文件时charset_dictpath参数指定的地方
下面为一个最基本的配置索引文件:
source documents
{
type = mysql
sql_host = 192.168.0.192
sql_user = root
sql_pass =
sql_db = test
sql_port= 3306
sql_query_pre= SET NAMES utf8
sql_query_pre = SET SESSION query_cache_type=OFF
sql_query_range = SELECT MIN(id),MAX(id) FROM documents
sql_range_step = 1000
sql_query = SELECT * FROM documents WHERE id >= $start AND id <= $end
sql_attr_uint= group_id
sql_attr_uint= group_id2
sql_query_post =
sql_ranged_throttle= 0
}
index document
{
source = documents
path = d:/csft/data/document
docinfo = extern
mlock = 0
stopwords =
min_word_len = 1
charset_type = zh_cn.utf-8
charset_dictpath = d:/csft/data
min_infix_len = 2
enable_star = 1
phrase_boundary = .,?,!,U+2026
phrase_boundary_step = 100
}
indexer
{
mem_limit = 512M
max_iops = 0
max_iosize = 0
}
searchd
{
# address = 0.0.0.0
listen = 3312
log = d:/csft/log/searchd.log
query_log = d:/csft/log/query.log
read_timeout = 10
max_children = 1000
pid_file = d:/csft/log/searchd.pid
max_matches = 10000
seamless_rotate = 0
}
更多推荐
所有评论(0)