Analyze the use of coreseek for sphinx_PHP tutorial

WBOY
Release: 2016-07-21 15:04:36
Original
742 people have browsed it

1. Unzip the downloaded file package and rename it to sphinx or something else. Then put it in a more suitable location, usually under the root directory of drive d.
2. Find the csft_mysql.conf file in D:sphinxetc and open it. It is recommended to use ue or editplus. Because Notepad will have no style when opened. This is because of the files under linux.
3. Make necessary modifications. Because this modification depends on the table and the content you want to get, there is no standard here. I can only give an example. My modification is like this:

Copy code The code is as follows:

#Source definition
source main
{
type = mysql
sql_host = 192.168.1.250
sql_user = root
sql_pass = 123456
sql_db = db_youxue
sql_port = 3306

sql_query_pre = SET NAMES utf8
sql_query_pre = set SESSION query_cache_type = OFF #I added
sql_query_pre = replace into sph_counter select 1,max(Fid) from t_store #What I added

sql_query = SELECT Fid, Ftitle, Fcontent, Fprovince,Fexamtitle, UNIX_TIMESTAMP(Fcreatetime) AS Fcreatetime FROM t_store where Fid<=(select FMAXID FROM SPH_COUNTER where fid = 1)
#SQL_QURY's first column ID needs to be an integer
#Title, Content as a string/text field, which is indexed by the full text
sql_attr_uint = fid# The value must be an integer
sql_attr_timestamp = Fcreatetime #The value read from SQL must be an integer, as a time attribute
sql_query_info = SELECT * FROM t_store WHERE Fid=$id #When querying on the command line, read the original value from the database Data information
}
#index definition
index main
{
source = main #Corresponding source name
path = var/data/mysql
docinfo = extern
mlock = 0
morphology = none
min_word_len = 1
html_strip = 0
#charset_dictpath = /usr/local/mmseg3/etc/ #BSD, Linux environment settings, ending with / symbol
charset_dictpath = etc/ #Set in Windows environment, ending with / symbol
charset_type = zh_cn.utf-8
}
#Global index definition
indexer
{
mem_limit = 128M
}
#searchd service definition
searchd
{
listen = 9312
read_timeout = 5
max_children = 30
max_matches = 1000
seamless_rotate = 0
preopen_indexes = 0
unlink_old = 1
pid_file = var/log/searchd_mysql.pid
log = var/log/searchd_mysql.log
query_log = var/log/query_mysql.log
}
source deltaMain: main
{
sql_query_pre = set names utf8
sql_query = SELECT Fid, Ftitle, Fcontent, Fprovince,Fexamtitle, UNIX_TIMESTAMP(Fcreatetime) AS Fcreatetime FROM t_store where Fid>(select Fmaxid from sph_counter where Fid=1)
}
index deltaMain: main
{
source = deltaMain
path = var/data/delta
}

Just configure it like this.
4. Find the sphinx directory in the command line. Then enter:
binindexer -c etccsft_mysql.conf
Press Enter. This is to generate a new index.

5. Then enter:
binindexer -c etccsft_mysql.conf --all
Enter. If the data here is large, it will take some time. Generally, it takes 20 seconds for 10,000 items. Anyway, there is no official word soon. Then enter:
binsearchd -c etccsft_mysql.conf --console and press Enter to start the searchd service. At this time, the searchd service can be found in the process of the task manager. In this way, the basic conditions for query are met.

6. Enter:
binsearchd -c etccsft_mysql.conf -a document
Press Enter, which means to search for all matches containing document.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327774.htmlTechArticle1. Unzip the downloaded file package and rename it to sphinx or something else. Then put it in a more suitable location, usually under the root directory of drive d. 2. Find...
in D:sphinxetc
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template