我将Sphinx版本从2.1.8更新到2.2.10,但它似乎没有太大的结果,现在狮身人面像很奇怪。 这是我的conf:
source tdp_products_src
{
type = mysql
sql_host = 127.0.0.1
sql_user = root
sql_pass =
sql_db = mydb
sql_port = 3306 # optional, default is 3306
sql_query_pre = SET NAMES utf8
sql_query = \
SELECT p.product_id , p.name, b.name as brand_name, p.url, p.description, p.properties from product p \
LEFT join brand b on p.brand_fk = b.brand_id \
WHERE p.deleted != 1 AND p.confirmed = 1
sql_attr_uint = url
sql_query_info = SELECT * FROM product WHERE product_id=$id
}
indexer
{
mem_limit = 32M
}
index tdp_products
{
source = tdp_products_src
path = /var/www/project/Sphinx/data/tdp_products
docinfo = extern
charset_type = utf-8
min_infix_len = 3
}
searchd
{
listen = 9312
listen = 9306:mysql41
log = /var/www/project/Sphinx/log/searchd.log
query_log = /var/www/project/Sphinx/log/query.log
read_timeout = 5
max_children = 30
pid_file = /var/www/project/Sphinx/log/searchd.pid
max_matches = 1000
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = /var/www/project/Sphinx/data
}
我正在使用PHP SphinxClient gigablah / sphinxphp ,这是我试过的:
$s = new SphinxClient;
$s->setServer($config['sphinx']['host'],$config['sphinx']['port']);
$s->setMatchMode(SPH_MATCH_ANY);
$foundProducts = $s->Query($data->phrase, 'tdp_products');
我的数据库有超过800种产品,我使用sphinx进行自动完成搜索,它在我更新sphinx之前正在运行。