Sphinx installation, sphinx
First, download a linux installation package from coreseek on your linux. Because the installation package does not exist on the official website, I have downloaded it from other channels. To open linux, first install the following dependency package; (If yes, you only need to update it) in the cd/usr directory, 1. yum-y install m4 autoconf automake libtool 2. yum-y install gcc-c ++ wget 3. yum-y install mysql-devel ## mmseg3 is a Chinese Word Segmentation plug-in. If the plug-in is not downloaded, you can upload the installation package contained in the basic document to linux. If the installation package is ready, run the following command: download the wget-nc unzip zxvf coreseek-3.2.14.tar.gz unzip command Cd coreseek-3.2.14 into the directory cd mmseg-3.2.14/into the Chinese word segmentation plug-in. /bootstrap. /configure -- prefix =/usr/local/mmseg3 check configuration make & make install compilation & compile and install echo $? Output 0 indicates that cd is correct .. /csft3.2.14/enter the configuration directory shbuildconf. sh executes the script. /configure -- prefix =/usr/local/coreseek -- without-python -- without-unixodbc -- with-mmseg-eclipdes =/usr/local/mmseg3/include/mmseg /-- with-mmseg-libs =/usr/local/mmseg3/lib/-- with-mysql -- host = arm check configuration cd/usr/local check whether there is mmseg3cd .. /cd coreseek-3.2.14/cd csft-3.2.14/installation process needs to modify a configuration file in the Windows Installation Package find the change after replacing the file vi src/sphinxexpr in linux. cpp and then convert all T va L = ExprEval (this-> m_pArg, tMatch )..... change to T val = this-> ExprEval (this-> m_pArg, tMatch) (we recommend that you take this file locally for modification) after the replacement, run the [root @ localhost csft-3.2.14] # makemake install cd/usr/local/coreseek/etc to enter the path of coreseek installation completed input ls will see three files example. SQL sphtasks. conf. the dist sphinx-min.conf.dist is now basically installed complete with example. SQL is a sample SQL script. We import it to the test database in the database as test data (two tables named documents and tags will be created) mysql-u root-pshow databases; use test; create Table source/ Usr/local/coreseek/etc/example. sqlexit; Create vi sphinx. enter the following content in conf: source src1 {type = mysqlsql_host = 192.168.214.128sql _ user = rootsql_pass = rootsql_db = testsql_port = 3306 # optional, default is 3306sql_sock =/tmp/mysql. socksql_query_pre = set names utf8sql_query = SELECT id, group_id, UNIX_TIMESTAMP (date_added) AS date_added, title, content FROM documentssql_attr_uint = group_idsql_attr_timestamp = Date_addedsql_query_info = SELECT * FROM statements WHERE id = $ id} source src2: src1 {SQL _query = SELECT 'id', 2 AS table_id, 'username', 'Password ', 'email ', 'salt ', 'from' from table_2} index test1 {source = src1path =/usr/local/coreseek/var/data/test1docinfo = externcharset_type = zh_cn.utf-8mlock = 0 morphology = fig = 1html_strip = 0charset_dictpath =/ usr/local/mmseg3/etc/ngram_l En = 0} index test2: test1 {source = src2 path = E: /SQL _DATA/coreseek/var/data/table_2} indexer {mem_limit = 32 M} searchd {port = 9312log =/usr/local/coreseek/var/log/searchd. logquery_log =/usr/local/coreseek/var/log/query. logread_timeout = 5max_children = 30pid_file =/usr/local/coreseek/var/log/searchd. pidmax_matches = 1000seamless_rotate = 1preopen_indexes = 0unlink_old = 1} enter cd/etc/Open vim l D. so. add conf:/usr/local/mysql/lib refresh ldconfig Description: The code segment source src1 {***} indicates that the data source mainly contains the database configuration information, and src1 indicates the data source name, you can write it at will. The code snippet index test1 {***} indicates the data source for which the index is created. It is paired with source ***. The value of the source parameter must be the name of a data source. For other parameters, refer to the manual. Index generation:/usr/local/coreseek/bin/indexer-c/usr/local/coreseek/etc/sphek. conf -- all: the parameter -- all indicates that all indexes can be generated, for example, the index name: /usr/local/coreseek/bin/indexer-c/usr/local/coreseek/etc/sphek. after conf test1 is executed, you can see more files in the/usr/local/coreseek/var/data directory, run the following command to test files with different extension names in the index name without starting sphinx: (this is the command line search for enabling sphinx, that is, number is the data name you want to query) /usr/local/coreseek/bin/searchd-c/usr/local/coreseek/etc/sphek. conf The search service function of ghost) create a file column in the directory of the site domain name for linux sphinx in Php, such as test. php in test. write the following content into the PHP file. (Note that the sphinxapi class must be loaded at the same level as test.) <? Phpheader ("content-type: text/html; charset = utf8"); include '. /sphinxapi. php '; $ sphenders = new SphinxClient (); $ sphenders-> SetServer ('IP address on linux', 9312 ); $ res = $ sphenders-> Query ("search field", "*"); // here * Indicates matching all the defined rules print_r ($ res);?> Vim/etc/rc. local self-starting folder