Coreseek Installing debugging under Windows

Source: Internet
Author: User

Because the project needs full-text search, and then went online to check the next information, found Sphinx "Chinese is the Sphinx" This full-text search engine, I heard it is very useful, but no Chinese participle. Back to look for a bit, found coreseek, a Chinese full-text retrieval/search software.

One, Sphinx php extension download

PHP already has a dedicated Sphinx extension file, Click here to download to different versions of the extension.

  

After the expansion is successfully installed, you can see the Sphinx information.

  

You can also achieve the same effect by referencing a PHP class file, which is the sphinxapi.php under the API folder. This is better to use, in debugging, found that if the DLL is directly referenced sometimes will report the method does not exist, but clearly in the Php:sphinx API description is there.

  

Second, installation Coreseek

1) I have downloaded a 4.1 version of this. According to the process of writing on the website, I have a local cloth.

This local directory can actually be built on its own, I feel so deep here, the DOS command is very troublesome.

  

  

2) Open the downloaded compressed package, etc, there are many conf configuration files.

In the Var\test file there is a Documents.sql file, this demo database, and so on will use this to do the test.

  

3) Copy the csft_mysql.conf file from etc into the bin and rename it to sphinx.conf.

Because my full-text search needs to work with the MySQL database, this file needs to be configured.

  

4) Modify the configuration file, just start the configuration file is not set, the old will error.

#MySQL数据源配置, for more information, see: http://www.coreseek.cn/products-install/mysql/#请先将var/test/ Documents.sql Import the database and configure the following MySQL user password database # source definition mysql{type = mysql Sql_host = Lo Calhost Sql_user = root Sql_pass = 123456 sql_db = Sphinx sql_p ORT = 3306 Sql_query_pre = SET NAMES UTF8 sql_query = SELECT ID, group_id,                                                              Unix_timestamp (date_added) as date_added, title, content from documents     #sql_query第一列id需为整数 #title, content as a string/text field, indexed by the full text Sql_attr_uint = group_id #从SQL读取到的值必须为整数 sql_attr_timestamp = date_added #从SQL读取到的值必须为整 Number, as the time attribute Sql_query_info_pre = set NAMES UTF8 #命令行查询时, set the correct character set Sql_qu Ery_info = SELECT * from documents where id= $id #命令行查询时, number#index定义index mysql{Source = mysql #对应的source名称 path = c:/usr/local/co, according to the library reading raw data information            Reseek-4.1-win32/var/data/documents #请修改为实际使用的绝对路径, for example:/usr/local/coreseek/var/... docinfo = extern Mlock = 0 Morphology = None Min_word_len = 1 Html_strip = 0 #中文分词配置, see for details: HT tp://www.coreseek.cn/products-install/coreseek_mmseg/#charset_dictpath =/usr/local/mmseg3/etc/#BSD, Linux environment settings,/ Symbol End charset_dictpath = c:/usr/local/coreseek-4.1-win32/etc/#Windows环境下设置,/end of symbol, preferably given absolute path, for example: C:/usr/local/corese    ek/etc/charset_type = zh_cn.utf-8} #全局index定义indexer {mem_limit = 128M} #searchd服务定义searchd { Compat_sphinxql_magics = 0 Listen = 9312 read_timeout = 5 Max_children = ax_matches = seamless_rotate = 0 preopen_indexes = 0 unlink_old = 1 p Id_file = C:/usr/local/coreseEk-4.1-win32/var/log/searchd_mysql.pid #请修改为实际使用的绝对路径, for example:/usr/local/coreseek/var/... log = c:/usr/local/ Coreseek-4.1-win32/var/log/searchd_mysql.log #请修改为实际使用的绝对路径, for example:/usr/local/coreseek/var/... query_log = C:/usr/lo                                Cal/coreseek-4.1-win32/var/log/query_mysql.log #请修改为实际使用的绝对路径, for example:/usr/local/coreseek/var/... binlog_path = #关闭binlog日志}

5) Build the index and make a DOS command.

  

In #index定义中, the path is set, and the index file can be seen in this path.

  

6) Open the console and let Sphinx listen to the port and receive the search command.

  

Searchd can be installed as a Windows service with the following commands:

c:\usr\local\coreseek> C:\usr\local\coreseek\bin\searchd.exe--install--config C:\usr\local\coreseek\etc\ coreseek.conf--servicename Coreseek

The searchd service should appear in the list of services such as Control Panel, System management. The service should appear in the list of services, control Panel, Systems management.

The command to delete the service is as follows:

SC Delete Coreseek

Third, the PHP code test
<?PHPHeader(' content-type:text/html; Charset=utf-8 ');//prevent Chinese display as garbled$s=NewSphinxclient;//The extension has been introduced, so no additional require files are required$s->setserver ("127.0.0.1", 9312); $s-Setmatchmode (sph_match_phrase); $s->setmaxquerytime (30); $res=$s->query (' Fools ', ' MySQL ');#[fool] keyword, [mysql] datasource source$err=$s-GetLastError (); Echo' <pre> '; Var_dump($res); Var_dump($err); Echo' </pre> ';

To view the results:

Compared to the database, you can see that the first data is searched.

Demo Download:

http://download.csdn.net/detail/loneleaf1/8285169

Resources:

Http://www.xingdonghai.cn/sphinx-2-0-3-windows-install-and-instructions/Sphinx 2.0.3 Windows installation and use instructions, attached query instance

http://my.oschina.net/melonol/blog/127438 Sphinx Chinese Word Search Coreseek Introduction to installation and basic use of Windows

http://blog.csdn.net/hfahe/article/details/5603294 Sphinx can't find the solution to the index file

http://my.oschina.net/melonol/blog/127441 Sphinx Full-Text Search tutorial for PHP use

Coreseek Installing debugging under Windows

Related Article

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.