Sphinxcoreseek _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Sphinxcoreseek. Some questions have been found on the above website. The following is my index configuration file mysql. conf content [php] sourcemysql {typemysqlsql_hostlocalhostsql_user has encountered some problems and found answers on the above website

The following is the content of my index configuration file 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
# The id of the first column of SQL _query must be an integer.
# Title and content are indexed by full text as string/text fields
# SQL _attr_uint = id # The value read from SQL must be an integer.
SQL _attr_uint = pic_id # The value read from SQL must be an integer.
SQL _attr_timestamp = datecreatedline # The value read from SQL must be an integer as a time attribute.
# SQL _attr_str2ordinal = title

}

# Index definition
Index mysql
{
Source = mysql # corresponding source name
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, set in Linux,/end of symbol
# Charset_dictpath = etc/# set in Windows,/end of the symbol
Charset_type = zh_cn.utf-8
}
# Global index definition
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
# The id of the first column of SQL _query must be an integer.
# Title and content are indexed by full text as string/text fields
# SQL _attr_uint = id # The value read from SQL must be an integer.
SQL _attr_uint = pic_id # The value read from SQL must be an integer.
SQL _attr_timestamp = datecreatedline # The value read from SQL must be an integer as a time attribute.
# SQL _attr_str2ordinal = title

}

# Index definition
Index mysql
{
Source = mysql # corresponding source name
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, set in Linux,/end of symbol
# Charset_dictpath = etc/# set in Windows,/end of the symbol
Charset_type = zh_cn.utf-8
}
# Global index definition
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 writing the index file, you need to create an index, and then create a process to use the php api.

Index creation command:

/Usr/local/coreseek/bin/indexer-c etc/mysql. conf mysql

/Usr/local/coreseek/bin/indexer-c index configuration file address Index Name


To re-create an index, add the -- rotate parameter at the end of the preceding statement.

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

Search by command:

/Usr/local/coreseek/bin/search-c etc/mysql. conf "test"


/Usr/local/coreseek/bin/indexer-c index configuration file address: the keyword to be searched

Start the service process:

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


During the test, only one service can be created. to create another service, you must disable the previous service.

For example, if csft. conf is enabled for a service

Ps-ef | grep core

We can see that the results contain

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


In this case, you need to disable csft. conf first.

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


This is to re-establish the mysql. conf service.


The contents of mysql. conf in my index configuration file [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.