NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
[TOC] ## 概述 配置两个表的全文索引 ``` source src1 { type = mysql # MySQL server information sql_host = localhost sql_user = root sql_pass = password sql_db = antdbms_wb # SQL query to retrieve data from the table sql_query = \ select * from im_group_msg\ sql_attr_uint = group_id sql_field_string = subject sql_field_string = content sql_field_string = send_name } source src2 { type = mysql # MySQL server information sql_host = localhost sql_user = root sql_pass = password sql_db = antdbms_wb # SQL query to retrieve data from the table sql_query = \ select * from im_msg_202304; # Defines what attributes should be stored and indexed # Defines which fields should be full-text indexed sql_field_string = subject sql_field_string = content sql_field_string = send_name } index index1 { source = src1 path = /var/data/index1 } index index2 { source = src2 path = /var/data/index2 } ``` 执行 sphinx ``` > indexer.exe --config=sphinx.conf --all // 创建索引文件 > searchd.exe --config=sphinx.conf [--install] // 启动服务 ,--install 表示注册 window 服务 > indexer.exe --config=sphinx.conf --rorate // 增量更新 ``` php 代码 ``` ```