Using Coreseek-4.1 to quickly build sphtracing Chinese Word Segmentation Php-Mysql full-text search

Source: Internet
Author: User
Tags automake
CentOS-6.4 installation Coreseek-4.1 use sphconf to improve project search performance this article only explains how to use in linux: Install Croeseek-4.1yum-yinstallglibc-commonlibtoolautoconfautomakemysql-develexpat-devel # if not installed this may be the following shbuildconf. sh will report an error !!!

CentOS-6.4 installation Coreseek-4.1 use Sphinx to improve project search performance this article only explains how to use in linux: install the Croeseek-4.1 yum-y install glibc-common libtool autoconf automake mysql-devel expat-devel # If This Is Not Installed, the following sh buildconf may be installed. sh will report an error !!!

CentOS-6.4Install Coreseek-4.1Use SphinxImprove project search performance this article only explains how to use: Install Croeseek-4.1 in linux
Yum-y install glibc-common libtool autoconf automake mysql-devel expat-devel # If This Is Not Installed, the following sh buildconf. sh may report an error !!! Cd/data/srctar-xjf ../software/autoconf-2.64.tar.bz2cd autoconf-2.64/./configuremake & make installcd ../cd/data/softwarewget http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.1-beta.tar.gzcd /Data/srctar zxf .. /software/coreseek-4.1-beta.tar.gzcd/coreseek-4.1-beta. /bootstrap. /configure -- prefix =/usr/local/mmseg3make & make installcd .. /cd/data/src/coreseek-4.1-beta/csft-4.1/sh buildconf. sh. /configure -- prefix =/usr/local/coreseek -- without-unixodbc -- with-mmseg-separated des =/usr/local/mmseg3/include/mmseg/--- mmseg-libs =/usr/local/mmseg3/lib/-- without-mysqlmake & make installcd .. // # test mmseg word segmentation, coreseek search (you need to set the character set to zh_CN.UTF-8 in advance to ensure that the correct display of Chinese) cd testpackcat var/test. xml # Chinese/usr/local/mmseg3/bin/mmseg-d/usr/local/mmseg3/etc var/test should be correctly displayed. xml/usr/local/coreseek/bin/indexer-c etc/csft. conf -- all/usr/local/coreseek/bin/search-c etc/csft. conf network search # create a sphinx index Script: mkdir-p/data/sh/other
Configure Sphinx to update the index bash script
vi /data/sh/other/sphinx_update_index.sh
The content is as follows:
#!/bin/bashCONFFILE=/usr/local/coreseek/etc/sphinx_index.conf/bin/sed s#var\/data\/#var\/data2\/#g ${CONFFILE} > ${CONFFILE}.2mkdir -p /usr/local/coreseek/var/data2#/usr/local/coreseek/bin/indexer --config ${CONFFILE}.2 --all --rotate/usr/local/coreseek/bin/indexer --config ${CONFFILE}.2 --allpkill -9 searchdsleep 4/bin/rm -rf /usr/local/coreseek/var/data//bin/mv /usr/local/coreseek/var/data2/ /usr/local/coreseek/var/data/sleep 2/usr/local/coreseek/bin/searchd --config ${CONFFILE}
Remember to set the execution permission
chmod 755 /data/sh/other/sphinx_update_index.sh
Configure sphsf-index source parameters
################################### PHPCMS #### ######################################## source cc_phpcms {type = mysql SQL _host = 172.26.11.75 # Here please change to your actual configuration SQL _user = phpcms # Here please change to your actual configuration SQL _pass = 123456 # Here please change to your actual configuration SQL _db = phpcms # Here please change to your actual configuration SQL _port = 3306 # Here please change to your actual configuration SQL _query_pre = set session query_cache_type = OFF SQL _query_pre = SET character_set_client = 'gbk' SQL _query_pre = SET character _ Set_connection = 'gbk' SQL _query_pre = SET character_set_results = 'utf8' SQL _query = SELECT 'id', 'catid', 'typeid', 'title', 'status ', 'updatetime' from 'I _ news' # Here please change to your actual configuration SQL _range_step = 1000 bytes = updatetime SQL _attr_uint = catid SQL _attr_uint = typeid serial = status SQL _query_post = Success = 0} index cc_phpcms {source = cc_phpcms path =/dev/shm/cc_phpcms # Put the ratio here This is a linux memory zone! Docinfo = extern mlock = 0 enable_star = 1 morphology = none stopwords = min_word_len = 1 charset_dictpath =/usr/local/mmseg3/etc/# note here charset_type = zh_cn.utf-8 # note here html_strip = 1 html_remove_elements = style, script html_index_attrs = img = alt, title; a = title ;} #################################### SETTING ### ######################################## # indexer {mem_limit = 300 M} searchd {# address = 0.0.0.0 # listen = 3312 # listen = 9312 # listen = 9306: mysql41 port = 3312 log =/usr/local/coreseek/var/log/searchd. log query_log =/usr/local/coreseek/var/log/query. log read_timeout = 5 max_children = 30 pid_file =/usr/local/coreseek/var/log/searchd. pid max_matches = 1000 seamless_rotate = 1}
Next we will implement data source support: Let Sphinx support MySQL DATA SOURCES
yum -y install mysql-devel libxml2-devel expat-develcd /data/src/coreseek-4.1-beta/csft-4.1/make cleansh buildconf.sh ./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-mysqlmake && make installcd ../
Note: if an ERROR occurs: "ERROR: cannot find MySQL include files ....... To disable MySQL support, use-without-mysql option. ", you can handle it as follows: please find the header file mysql. the directory where h is located, usually/usr/local/mysql/include. Replace it with the actual directory and find the library file libmysqlclient. the directory where a is located, usually/usr/local/mysql/lib. Replace it with the actual onfigure parameter and add: -with-mysql-connector des =/usr/local/mysql/include-with-mysql-libs =/usr/local/mysql/lib. After execution, re-compile and install # Run the sphinx service script
/data/sh/other/sphinx_update_index.sh
If everything is normal, you will see the information for creating an index as follows: [caption id = "attachment_1192" align = "alignnone" width = "620"] Using Coreseek-4.1 to quickly build a sphsf-chinese word segmentation Php-Mysql full-text search engine [/caption]/data/sh /other/sphinx_update_index.sh once, please
vi /data/sh/other/sphinx_update_index.sh
Set
#/usr/local/coreseek/bin/indexer --config ${CONFFILE}.2 --all --rotate/usr/local/coreseek/bin/indexer --config ${CONFFILE}.2 --all
Change
/usr/local/coreseek/bin/indexer --config ${CONFFILE}.2 --all --rotate#/usr/local/coreseek/bin/indexer --config ${CONFFILE}.2 --all
That is, change the annotations so that you can set a scheduled task to run the/data/sh/other/sphinx_update_index.sh script. After the/sphinx_update_index.sh script is run, the index is automatically re-created using the-rotate method, that is, the newly added content will also be indexed.

Use Coreseek-4.1 to quickly build a Chinese Word Segmentation Php-Mysql full-text search engine, thanks to the original author to share.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.