我一直在使用 sphinxapi.php 并且脚本运行良好,你可以在这个 pastebin中查看它。您可以在这里查看我的表结构,这就是我的 sphinx.conf 文件的设置方式:
# Minimal Sphinx configuration sample (clean, simple, functional)
#
#Movie Source
source movielist
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = jetru9rU
sql_db = imdb
sql_port = 3306
sql_query = \
SELECT id, title, subtitle, year_created FROM movielist
sql_attr_string = title
sql_attr_string = subtitle
sql_attr_uint = year_created
sql_query_info = SELECT * FROM movielist WHERE id=$id
}
#Movie Index
index movieindex
{
source = movielist
path = /var/data/movieindex
docinfo = extern
charset_type = sbcs
}
#Realtime indexing
index movieindexrt
{
type = rt
rt_mem_limit = 32M
path = /var/data/movieindexrt
charset_type = utf-8
rt_field = title
rt_field = subtitle
}
indexer
{
mem_limit = 32M
}
searchd
{
listen = 9312
listen = 9306:mysql41
log = /var/log/sphinxsearch/searchd.log
query_log = /var/log/sphinxsearch/query.log
read_timeout = 5
max_children = 30
pid_file = /var/log/sphinxsearch/searchd.pid
max_matches = 1000
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = /var/data
}
我没有看到的 .conf 文件有什么问题?