This example describes the Sphinx index configuration method in the Yii framework. Share to everyone for your reference, specific as follows:
Please import var/test/documents.sql into the database and configure the following MySQL user password database
#源定义 source MySQL {type = mysql Sql_host = localhost Sql_user = root Sql_pass = Ro OT sql_db = yii2 Sql_port = 3306 sql_query_pre = SET NAMES UTF8 = SELECT ID, Zhan_name, URL, title, xu_id, Status, Unix_timestamp (Addtime) as Addtime from Zhan #sql_query第一列id需为整数 #title, content As a string/text field, the Full-text index #sql_attr_uint = Price #从SQL读取到的值必须为整数 Sql_attr_timestamp = Addtime #从SQL读取到的值必须为整数, as Property Sql_query_info_pre = Set NAMES UTF8 #命令行查询时, set the correct character set sql_query_info = SELECT * from Zhan WHERE id= $id #命令行查询时 to read raw data information from the database} #源定义2 source Mysql_goods {type = mysql sql_host = localhost sq L_user = root Sql_pass = root sql_db = Yii2 Sql_port = 3306 Sql_query_pre = SET NAMES UTF8 sql_query = SELECT ID, goods_name, price from goods #sql_query第一列id需为整数 #title, content as a string/text field, Sql_attr_uint by Full-text Indexing = Price #从SQL读取到的值必须为整数 #sql_attr_timestamp = Addtime #从SQL读取到的值必须为整数, as time attribute Sql_query_info_pre = SET NAM
ES UTF8 #命令行查询时, set the correct character set sql_query_info = SELECT * from goods WHERE id= $id #命令行查询时, read raw data from the database #index定义 index MySQL {source = mysql #对应的source名称 path = d:/yii/advanced/vendor/coreseek-4.1-win32/ Var/data/mysql #请修改为实际使用的绝对路径, for example:/usr/local/coreseek/var/... docinfo = extern Mlock = 0 morphology = no Ne min_word_len = 1 Html_strip = 0 #charset_dictpath =/usr/local/mmseg3/etc/#BSD, Linux environment set,/symbol end Char Set_dictpath = d:/yii/advanced/vendor/coreseek-4.1-win32/etc/#Windows环境下设置,/symbol end, best given absolute path, for example: C:/USR/LOCAL/C oreseek/etc/charset_type = zh_cn.utf-8} #index定义2 index Mysql_goods {Source = Mysql_goods #对应的sourc
E name path = D:/yii/advanced/vendor/coreseek-4.1-win32/var/data/goods #请修改为实际使用的绝对路径, for example:/usr/local/coreseek/var/...
DocInfo = extern Mlock = 0 Morphology = None Min_word_len = 1 Html_strip = 0 #charset_dictpath =/usr/local/mmse g3/etc/#BSD, Linux settings,/symbol endings Charset_dictpath = d:/yii/advanced/vendor/coreseek-4.1-win32/etc/#Windows环境 Below set,/symbol end, best given absolute path, for example: c:/usr/local/coreseek/etc/charset_type = zh_cn.utf-8} #全局index定义 Indexer {mem_limit = 128M} #searchd服务定义 searchd {listen = 9312 Read_timeout = 5 Max_children = max_matches = 1000 Seamless_rotate = 0 preopen_indexes = 0 Unlink_old = 1 pid_file = D:/yii/advanced/vendor/corese Ek-4.1-win32/var/log/searchd_mysql.pid #请修改为实际使用的绝对路径, for example:/usr/local/coreseek/var/... log = d:/yii/advanced/vendor/ Coreseek-4.1-win32/var/log/searchd_mysql.log #请修改为实际使用的绝对路径, for example:/usr/local/coreseek/var/... query_log = D:/yii/ Advanced/vendor/coreseek-4.1-win32/var/log/query_mysql.log #请修改为实际使用的绝对路径, for example:/usr/local/coreseek/var/... binlog_
Path = #关闭binlog日志}
For more information on YII-related content, readers who are interested in this site can view the topics: Introduction to YII Framework and summary of common skills, "Summary of PHP Excellent development framework", "Smarty Template Introductory Course", "Introduction to PHP object-oriented programming", "PHP string" Summary of Usage , "Php+mysql Database operation Introduction Tutorial" and "PHP common database Operation Skills Summary"
I hope this article will help you with the PHP program design based on the YII framework.