🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[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 代码 ``` ```