Use of coreseekforsphinx

Source: Internet
Author: User
This article provides a detailed analysis of coreseekforsphinx. For more information, see section 1. decompress the downloaded package and rename it sphinx or others. Put it in a suitable location, usually under the root directory of the D disk.
2. find the csft_mysql.conf file in D: \ sph1_\ etc and open it. ue or editplus is recommended. Because there will be no style when notepad is opened. This is because of files in linux.
3. make necessary modifications. Because this modification is different from the table and the content you want to get, there is no standard here, and I can only modify it for an instance as follows:

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 # My added
SQL _query_pre = replace into sph_counter select 1, max (Fid) from t_store # My 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)
# 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 = Fid # The value read from SQL 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 # The original data is read FROM the database during command line query.
}
# 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, set in Linux, and end with a/symbol
Charset_dictpath = etc/# set in Windows,/end of symbol
Charset_type = zh_cn.utf-8
}
# Global index definition
Indexer
{
Mem_limit = 128 M
}
# 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
}


In this way, you can configure it.
4. find the sphinx directory in the command line. Then enter:
Bin \ indexer-c etc \ csft_mysql.conf
Press enter to generate a new index.

5. enter:
Bin \ indexer-c etc \ csft_mysql.conf -- all
Press Enter. if the data here is big, it will take some time. Generally, it takes 10000 messages and 20 seconds. There is no official explanation. Enter:
Bin \ searchd-c etc \ csft_mysql.conf -- enter the console to start the searchd service. In this case, you can find the searchd service in the Task Manager process. In this way, the basic query conditions are met.

6. input:
Bin \ searchd-c etc \ csft_mysql.conf-a document
Press enter to search for all matching items that contain the document.

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.