In the Yii framework, the sphsf-index configuration method is resolved.
This article describes how to configure the sphinx index in the Yii framework. We will share this with you for your reference. The details are as follows:
Import var/test/documents. SQL to the database, and configure the following MySQL user password database.
# Source mysql {type = mysql SQL _host = localhost SQL _user = root SQL _pass = root SQL _db = yii2 SQL _port = 3306 SQL _query_pre = set names utf8 SQL _query = SELECT id, zhan_name, url, title, xu_id, status, UNIX_TIMESTAMP (addtime) as addtime FROM zhan # id of the first column of SQL _query must be an integer # title, content as a string/text field, full-text index # SQL _attr_uint = price # The value read from SQL must be an integer SQL _attr_timestamp = addtime # The value read from SQL must be an integer, as the time attribute SQL _query_info_pre = set names utf8 # When querying the command line, SET the correct character SET SQL _query_info = SELECT * FROM zhan WHERE id = $ id # When querying the command line, read original data from the database} # source Definition 2 source mysql_goods {type = mysql SQL _host = localhost SQL _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 # the id of the first column of SQL _query must be an integer # the title and content are used as strings/text fields, SQL _attr_uint = price # The value read from SQL must be an integer # SQL _attr_timestamp = addtime # The value read from SQL must be an integer, as the time attribute SQL _query_info_pre = set names utf8 # When querying the command line, SET the correct character SET SQL _query_info = SELECT * FROM goods WHERE id = $ id # When querying the command line, read original data from the database} # index definition index mysql {source = mysql # corresponding source name path = D: /yii/advanced/vendor/coreseek-4.1-win32/var/data/mysql # Please change to the absolute path actually used, for example:/usr/local/coreseek/var /... docinfo = extern mlock = 0 morphology = none min_word_len = 1 html_strip = 0 # charset_dictpath =/usr/local/mmseg3/etc/# BSD, set in Linux environment, /character end charset_dictpath = D:/yii/advanced/vendor/coreseek-4.1-win32/etc/# Windows environment settings,/Symbol end, it is best to give an absolute path, such as: C: /usr/local/coreseek/etc /... charset_type = zh_cn.utf-8} # index Definition 2 index mysql_goods {source = mysql_goods # corresponding source name path = D: /yii/advanced/vendor/coreseek-4.1-win32/var/data/goods # Please change to the absolute path actually used, for example:/usr/local/coreseek/var /... docinfo = extern mlock = 0 morphology = none min_word_len = 1 html_strip = 0 # charset_dictpath =/usr/local/mmseg3/etc/# BSD, set in Linux environment, /character end charset_dictpath = D:/yii/advanced/vendor/coreseek-4.1-win32/etc/# Windows environment settings,/Symbol end, it is best to give an absolute path, such as: C: /usr/local/coreseek/etc /... charset_type = zh_cn.utf-8} # global index definition indexer {mem_limit = 128 M} # searchd service definition searchd {listen = 9312 read_timeout = 5 max_children = 30 max_matches = 1000 bytes = 0 preopen_indexes = 0 unlink_old = 1 pid_file = D: /yii/advanced/vendor/coreseek-4.1-win32/var/log/searchd_mysql.pid # Please change to the actual absolute path used, for example:/usr/local/coreseek/var /... log = D:/yii/advanced/vendor/coreseek-4.1-win32/var/log/searchd_mysql.log # change to the actual absolute path, for example: /usr/local/coreseek/var /... query_log = D:/yii/advanced/vendor/coreseek-4.1-win32/var/log/query_mysql.log # change it to the actual absolute path, for example: /usr/local/coreseek/var /... binlog_path = # disable binlog}