时间:2021-07-01 10:21:17 帮助过:21人阅读
#MySQL数据源配置,详情请查看:http://www.coreseek.cn/products-install/mysql/
#请先将var/test/documents.sql导入数据库,并配置好以下的MySQL用户密码数据库
#源定义
source cetsix
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = cai123
sql_db = words
sql_port = 3306
sql_query_pre = SET NAMES UTF8
sql_query = SELECT id, meaning ,lx FROM cetsix
}
#index定义
index cetsix
{
source = cetsix #对应的source名称
path = E:\CodeEdit\php\ciba\niujin-alpha\sphinx\var\data\cetsix
docinfo = extern
mlock = 0
morphology = none
min_word_len = 1
html_strip = 0
charset_dictpath = E:\CodeEdit\php\ciba\niujin-alpha\sphinx\etc
charset_type = utf-8
}
indexer
{
mem_limit = 128M
}
#searchd服务定义
searchd
{
listen = 3312
read_timeout = 5
max_children = 30
max_matches = 100
seamless_rotate = 1
preopen_indexes = 0
unlink_old = 1
#最大允许的过滤器数
max_filters = 256
#每个过滤器最大允许的值的个数
max_filter_values = 4096
#日志文件保存路径
pid_file = E:\CodeEdit\php\ciba\niujin-alpha\sphinx\var\log\searchd_mysql.pid
log = E:\CodeEdit\php\ciba\niujin-alpha\sphinx\var\log\searchd_mysql.log
query_log = E:\CodeEdit\php\ciba\niujin-alpha\sphinx\var\log\query_mysql.log
}
header("content-type: text/html; charset=utf-8");
require_once "sphinxapi.php";
$sphinx = new SphinxClient();
$sphinx->setServer("127.0.0.1", 3312);
$sphinx->setMatchMode('SPH_MATCH_ANY');
$res = $sphinx->query('man', "cetsix");
var_dump($res);
?>
mysql> SHOW CREATE TABLE cetsix
-> ;
+--------+---------------------------------------------------
| Table | Create Table
+--------+---------------------------------------------------
| cetsix | CREATE TABLE `cetsix` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`word` varchar(255) NOT NULL,
`meaning` varchar(255) NOT NULL,
`lx` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=13325 DEFAULT CHARSET=utf8 |
+--------+---------------------------------------------------