Introduction and installation of sphinx and introduction to sphinx
IntroductionBackground: 1. large data volume, slow indexing of existing search resumes; Staff Flow, difficult to maintain existing search 2. front-end calls are complex; full table scans are used, resulting in slow search speeds; no sorting of results; it is difficult to find the most accurate data as soon as possible. Recommended optimization: 1. high-speed index creation 2. avoid the like operation on the database and reduce the pressure. sort the weights of search results. 4. convenient call for front-end development 5. it is best to have a low threshold, be easy to master, and maintain later.
Install
1. Install the lamp Environment
Skip this step if you have already installed it.
2. download the required files
Note: If you use Ubuntu 10.10 (sphinxsearch), you can directly install it using apt-get install. skip this step (Chinese Word Segmentation is not supported)
Coreseek Fulltext Server (source code): http://www.coreseek.cn/uploads/csft/3.1/Source/csft-3.1.tar.gz
Coreseek Mmseg (source code): http://www.coreseek.cn/uploads/csft/3.1/Source/mmseg-3.1.tar.gz
3. tools must be installed
Sudo apt-get install autoconf automake autotools-dev cpp curl gawk gcc lftp libc6-dev linux-libc-dev make libpcre3-dev libpcrecpp0 g ++ libtool libncurses5-dev
Sudo aptitude install libmysql ++-dev libmysqlclient15-dev checkinstall
4. Install mmseg
Sudo su
Tar zxvf mmseg-3.1.tar.gz
Mkdir/usr/local/mmseg
Cd mmseg-3.1
./Configure -- prefix =/usr/local/mmseg
Make
Make install
5. Install sphinx
Note: If you use Ubuntu 10.10 (sphinxsearch), you can use sudo apt-get install sphinxsearch for quick installation (however, Chinese Word Segmentation is not supported)
If not, use the following command:
(If mysql is manually installed, change -- with-mysql to the mysql installation directory)
Tar zxvf csft-3.1.tar.gz
Mkdir/usr/local/coreseek
Cd csft-3.1
. /Configure -- prefix =/usr/local/coreseek -- with-mysql -- with-mmseg-separated des =/usr/local/mmseg/include/mmseg -- with-mmseg-libs =/ usr/local/mmseg/lib/
Make clean
Make
Make install
6. Test
The installation is complete. The following is a test.
Note: If you use Ubuntu 10.10 (sphinxsearch), the following configuration file sphsf-. conf. dist should be in the/etc/sphinxsearch directory.
Cd/usr/local/coreseek/etc
Sudo cp sphinx. conf. dist sphinx. conf
Sudo vim sphinx. conf (the modification example is as follows)
Mysql-uroot test </usr/local/coreseek/etc/example. SQL (l create a sample data table, of course, you can also use phpmyadmin to import)
Note: If you use Ubuntu 10.10 (sphinxsearch), you can run the following commands: sudo indexer -- all and sudo search test.
Sudo/usr/local/coreseek/bin/indexer-c/usr/local/coreseek/etc/sphinx. conf -- all
Sudo/usr/local/coreseek/bin/search-c/usr/local/coreseek/etc/sphek. conf test
Sudo/usr/local/coreseek/bin/searchd-c/usr/local/coreseek/etc/sphek. conf (start the searchd process for sphinxapi call)
Note: If you use Ubuntu 10.10 (sphinxsearch), the following parameters should be modified as follows:
Path =/var/lib/sphinxsearch/data/idxbook1
Log =/var/log/sphinxsearch/searchd. log
Query_log =/var/log/sphinxsearch/query. log
Pid_file =/var/run/searchd. pid
The charset_dictpath and charset_table parameters are not supported, that is, Chinese Word Segmentation is not supported.