_php Tutorial on Sphinx coreseek

Source: Internet
Author: User
Encountered some problems also found in the above Web site answers

Below is the contents of my index profile mysql.conf


[PHP]
SOURCE MySQL
{
Type = MySQL

Sql_host = localhost
Sql_user = root
Sql_pass = Mfy
sql_db = Zlk
Sql_port = 3306
Sql_query_pre = SET NAMES UTF8

Sql_query = SELECT Id,pic_id,city,captionwriter,countryname,title,description,contenttype,generator,author, Keyword,language,datecreatedline from Picture_info
#sql_query第一列id需为整数
#title, content as a string/text field, indexed by the full text
# sql_attr_uint = ID #从SQL读取到的值必须为整数
Sql_attr_uint = pic_id #从SQL读取到的值必须为整数
Sql_attr_timestamp = Datecreatedline #从SQL读取到的值必须为整数, as a time attribute
# sql_attr_str2ordinal = Title

}

#index定义
Index MySQL
{
Source = MySQL #对应的source名称
Path =/usr/local/coreseek/var/data/mysql

DocInfo = extern
Mlock = 0
Morphology = None
Min_word_len = 1
Min_infix_len =1
Html_strip = 0
Charset_dictpath =/usr/local/mmseg3/etc/#BSD, settings under Linux,/end of symbol
#charset_dictpath = etc/#Windows环境下设置,/end of symbol
Charset_type = Zh_cn.utf-8
}
#全局index定义
Indexer
{
Mem_limit = 2G
}


Searchd
{
Listen = 9312
Max_matches = 10000
Pid_file =/usr/local/coreseek/var/log/searchd_mysql.pid
Log =/usr/local/coreseek/var/log/searchd_mysql.log
Query_log =/usr/local/coreseek/var/log/query_mysql.log
}

SOURCE MySQL
{
Type = MySQL

Sql_host = localhost
Sql_user = root
Sql_pass = Mfy
sql_db = Zlk
Sql_port = 3306
Sql_query_pre = SET NAMES UTF8

Sql_query = SELECT Id,pic_id,city,captionwriter,countryname,title,description,contenttype,generator,author, Keyword,language,datecreatedline from Picture_info
#sql_query第一列id需为整数
#title, content as a string/text field, indexed by the full text
# sql_attr_uint = ID #从SQL读取到的值必须为整数
Sql_attr_uint = pic_id #从SQL读取到的值必须为整数
Sql_attr_timestamp = Datecreatedline #从SQL读取到的值必须为整数, as a time attribute
# sql_attr_str2ordinal = Title

}

#index定义
Index MySQL
{
Source = MySQL #对应的source名称
Path =/usr/local/coreseek/var/data/mysql

DocInfo = extern
Mlock = 0
Morphology = None
Min_word_len = 1
Min_infix_len =1
Html_strip = 0
Charset_dictpath =/usr/local/mmseg3/etc/#BSD, settings under Linux,/end of symbol
#charset_dictpath = etc/#Windows环境下设置,/end of symbol
Charset_type = Zh_cn.utf-8
}
#全局index定义
Indexer
{
Mem_limit = 2G
}


Searchd
{
Listen = 9312
Max_matches = 10000
Pid_file =/usr/local/coreseek/var/log/searchd_mysql.pid
Log =/usr/local/coreseek/var/log/searchd_mysql.log
Query_log =/usr/local/coreseek/var/log/query_mysql.log
}

After you have written the index file, you need to index it and then build the process to use the PHP API.

To index the command:

/usr/local/coreseek/bin/indexer-c etc/mysql.conf MySQL

/usr/local/coreseek/bin/indexer-c index configuration file address index name


If you need to re-establish the index, add the--rotate parameter to the end of the above statement

/usr/local/coreseek/bin/indexer-c etc/mysql.conf MySQL--rotate

To search using a command:

/usr/local/coreseek/bin/search-c etc/mysql.conf "Test"


/USR/LOCAL/CORESEEK/BIN/INDEXER-C index profile address to search for keywords

To start the service process:

/usr/local/coreseek/bin/searchd-c etc/mysql.conf


I can only set up a service when I'm testing. When you want to set up another service, you need to turn off the previous service.

For example I have now opened a service service is csft.conf, then I use

Ps-ef | grep core

You can see that the results have

Root 11730 1 0 14:33 pts/0 00:00:00/usr/local/coreseek/bin/searchd-c etc/csft.conf


This line, you need to turn off csft.conf first.

/usr/local/coreseek/bin/searchd-c etc/csft.conf--stop


This is the only mysql.conf service that can be re-established.


http://www.bkjia.com/PHPjc/477313.html www.bkjia.com true http://www.bkjia.com/PHPjc/477313.html techarticle encountered some problems also found in the above Web site answer the following is the contents of my index profile mysql.conf [PHP] source mysql {type = mysql sql_host = localhost sql_user ...

  • 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.