Due to the needs of the company website, I have been working on the sphinx search engine recently, and I have also encountered various problems, which were finally solved.
Server system: centos7 (64-bit)
For details, please refer to the installation tutorial on the official website for coreseek 3.2.14
Here are just some things to note
1: Install basic development libraries and database dependencies before installation
<span>yum</span> <span>install</span> <span>make</span> <span>gcc</span> g++ <span>gcc</span>-c++ libtool autoconf automake imake mysql-devel libxml2-devel expat-devel:
2: Download
<span>wget</span> http:<span>//</span><span>www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.14.tar.gz</span>
3: Install mmseg, there should be no problem here.
$ cd mmseg-<span>3.2</span>.<span>14</span><span> $ .</span>/<span>bootstrap #输出的warning信息可以忽略,如果出现error则需要解决 $ .</span>/configure --prefix=/usr/local/<span>mmseg3 $ </span><span>make</span> && <span>make</span> <span>install</span><span> $ cd ..</span>
4: Install csft
Enter the csft directory and modify the file src/spixexpr.cpp first. There are 3 places in which compilation errors will occur
<span>将ExprEval改为this->ExprEval</span>
Then proceed to the next step of installation and that’s it.
<span>sh</span> buildconf.<span>sh</span><span> .</span>/configure --prefix=/usr/local/coreseek --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-<span>mysql </span><span>make</span> && <span>make</span> <span>install</span>
5: Then there is the configuration file, copy it to the installation directory
cd /usr/local/coreseek/<span>etc </span><span>cp</span><span> sphinx.conf.dist sphinx.conf vim sphinx.conf</span>
Mainly modify the database parameters, and for other warning issues, just comment out the corresponding content in the configuration file. No problems have been found yet
type =<span> mysql sql_host </span>=<span> localhost sql_user </span>=<span> root sql_pass </span>=<span> sql_db </span>=<span> test sql_port </span>= <span>3306</span><span> sql_query_pre </span>= SET NAMES utf8
Then save and generate index
cd /usr/local/coreseek/<span>bin .</span>/indexer -c /usr/local/coreseek/etc/sphinx.conf --<span>all .</span>/searchd -c /usr/local/coreseek/etc/sphinx.conf
Import test data and call test files
<span>require</span> ( "sphinxapi.php"<span> ); </span><span>$cl</span> = <span>new</span><span> SphinxClient (); </span><span>$cl</span>->SetServer ( '127.0.0.1', 9312<span>); </span><span>$cl</span>->SetConnectTimeout ( 3<span> ); </span><span>$cl</span>->SetArrayResult ( <span>true</span><span> ); </span><span>$cl</span>-><span>SetMatchMode ( SPH_MATCH_ANY); </span><span>$res</span> = <span>$cl</span>->Query ( '网络搜索', "*"<span> ); </span><span>print_r</span>(<span>$cl</span><span>); </span><span>print_r</span>(<span>$res</span>);
There should be no problem. Make sure the system Chinese is zh_CN.UTF-8 to ensure Chinese display
The following is the situation of my own company. Some people may also have this situation.
The search engine is on one server, and the website and database are on another server. In this case, you need to consider
1: During coreseek installation, if it prompts that the libmysqlclient.so.18 shared library cannot be found
Copy a copy of libmysqlclient.so.18 on the mysql server, the path is /usr/lib64/mysql/libmysqlclient.so.18
2: Whether the firewall port of the server where the search engine is located is open
Install centos7 first
<span>yum</span> <span>install</span> firewalld-config
Then open the port
firewall-cmd [--zone=<zone>] --add-port=<port>[-<port>]/<protocol> [--timeout=<seconds>]<br />firewall-cmd --permanent --add-port=10-9900/tc
Query
firewall-cmd --permanent --query-port=<span>80</span>/tcp
3: The website php calling api version must be consistent with the coreseek version.
The test process can be output directly in php
<span>var_dump</span>(<span>$cl</span>);<span>//</span><span>$cl为sphinxClient对象</span>
View error messages.
Once the above problems are solved, you should be able to use it normally.