Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install coreseek in centos

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about how to install coreseek in centos, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

First, brief introduction to coreseek

Coreseek is a Chinese full-text search / search software, released under the GPLv2 license agreement, developed and released independently based on Sphinx, specializing in Chinese search and information processing, suitable for industry / vertical search, forum / site search, database search, document / literature search, information retrieval, data mining and other application scenarios. Commercial use (for example, embedding in other programs) requires commercial authorization.

Coreseek is a Chinese full-text search engine that aims to provide Chinese full-text search capabilities with high-speed, low space footprint and highly relevant results for other applications. CoreSeek can be easily integrated with SQL databases and scripting languages.

The native search API provided in the Sphinx distribution supports PHP, Python, Perl, Rudy, and Java. Search API is very lightweight and can be ported to a new language in a few hours. Third-party API interfaces and plug-ins provide support for Perl, C #, Haskell, Ruby-on-Rails, and other possible languages or frameworks.

Introduction to the version

Coreseek 3.2 stable version

Coreseek 4.1Test version

The latest version of Coreseek 5

Second, install Coreseek

Note: this article is a coreseek installation tutorial based on centos+mysql as data source support. MySQL installation is skipped.

1. Download coreseek 3.2 stable version. Download other versions, please go to the official website and download them yourself.

Cd / usr/local/src/

Wget http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.14.tar.gz

Tar xzvf coreseek-3.2.14.tar.gz

Cd coreseek-3.2.14

Before installing coreseek, you need to install the software that needs to be pre-installed: yum install make gcc gaming + gcc-c++ libtool autoconf automake imake mysql-devel libxml2-devel expat-devel (Note: this is centos 64-bit

For other systems, please refer to http://www.coreseek.cn/product_install/install_on_bsd_linux/#deps

2, install mmseg

$cd mmseg-3.2.14

The output warning information of $. / bootstrap # can be ignored. If error occurs, it needs to be resolved.

$. / configure-prefix=/usr/local/mmseg3

$make & & make install

$cd..

# # if prompted with libtool: unrecognized option `- tag=CC', please check the solution to the libtool problem

# # after installation, the dictionaries and configuration files used by mmseg will be automatically installed into / usr/local/mmseg3/etc

# # Chinese word Segmentation Test. If the display is abnormal, please check the locale and UTF-8 Chinese character display settings in the current environment.

$/ usr/local/mmseg3/bin/mmseg-d / usr/local/mmseg3/etc src/t1.txt

Chinese / x score / x word / x test / x

Chinese / x Shanghai / x

Word Splite took: 1 ms.

3. Install coreseek

$cd csft-3.2.14

# # execute configure to compile and configure:

$sh buildconf.sh

$. / configure-prefix=/usr/local/coreseek-without-unixodbc-with-mmseg--with-mmseg-includes=/usr/local/mmseg3/include/mmseg/-with-mmseg-libs=/usr/local/mmseg3/lib/-with-mysql

If the mysql includes file cannot be found, use the following compile command

. / configure-prefix=/usr/local/coreseek-without-unixodbc-with-mmseg--with-mmseg-includes=/usr/local/mmseg3/include/mmseg/-with-mmseg-libs=/usr/local/mmseg3/lib/-with-mysql-includes=/alidata/server/mysql/include/-with-mysql-libs=/alidata/server/mysql/bin/

Make & & make install

4, test coreseek

Cd.. / testpack

$/ usr/local/coreseek/bin/indexer-c etc/csft.conf

# # the following are the prompts under normal circumstances:

Coreseek Fulltext 3.2 [Sphinx 0.9.9-release (r2117)]

Copyright (c) 2007-2010

Beijing Choice Software Technologies Inc (http://www.coreseek.com)

Using config file 'etc/csft.conf'...

Total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg

Total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg

# #

# # csft-4.0 version shows: ERROR: nothing to do.

# #

$/ usr/local/coreseek/bin/indexer-c etc/csft.conf-all

# # the following are the prompts for normal indexing of all data: (csft-4.0 version is similar)

Coreseek Fulltext 3.2 [Sphinx 0.9.9-release (r2117)]

Copyright (c) 2007-2010

Beijing Choice Software Technologies Inc (http://www.coreseek.com)

Using config file 'etc/csft.conf'...

Indexing index 'xml'...

Collected 3 docs, 0.0 MB

Sorted 0.0 Mhits, 100.0% done

Total 3 docs, 7585 bytes

Total 0.075 sec, 101043 bytes/sec, 39.96 docs/sec

Total 2 reads, 0.000 sec, 5.6 kb/call avg, 0.0 msec/call avg

Total 7 writes, 0.000 sec, 3.9 kb/call avg, 0.0 msec/call avg

$/ usr/local/coreseek/bin/indexer-c etc/csft.conf xml

# # the following prompts when specifying data for a normal index: (csft-4.0 version is similar)

Coreseek Fulltext 3.2 [Sphinx 0.9.9-release (r2117)]

Copyright (c) 2007-2010

Beijing Choice Software Technologies Inc (http://www.coreseek.com)

Using config file 'etc/csft.conf'...

Indexing index 'xml'...

Collected 3 docs, 0.0 MB

Sorted 0.0 Mhits, 100.0% done

Total 3 docs, 7585 bytes

Total 0.069 sec, 109614 bytes/sec, 43.35 docs/sec

Total 2 reads, 0.000 sec, 5.6 kb/call avg, 0.0 msec/call avg

Total 7 writes, 0.000 sec, 3.9 kb/call avg, 0.0 msec/call avg

$/ usr/local/coreseek/bin/search-c etc/csft.conf

# # the following is the prompt for normal test search: (csft-4.0 version is similar)

Coreseek Fulltext 3.2 [Sphinx 0.9.9-release (r2117)]

Copyright (c) 2007-2010

Beijing Choice Software Technologies Inc (http://www.coreseek.com)

Using config file 'etc/csft.conf'...

Index 'xml': query': returned 3 matches of 3 total in 0.093 sec

Displaying matches:

1. Document=1, weight=1, published=Thu Apr 1 22:20:07 2010, author_id=1

2. Document=2, weight=1, published=Thu Apr 1 23:25:48 2010, author_id=1

3. Document=3, weight=1, published=Thu Apr 1 12:01:00 2010, author_id=2

Words:

$/ usr/local/coreseek/bin/search-c etc/csft.conf-a Twittter and Opera both provide search services

# # the following are the prompts for searching keywords in a normal test: (csft-4.0 version is similar)

Coreseek Fulltext 3.2 [Sphinx 0.9.9-release (r2117)]

Copyright (c) 2007-2010

Beijing Choice Software Technologies Inc (http://www.coreseek.com)

Using config file 'etc/csft.conf'...

Index 'xml': query' Twittter and Opera both provide search services: returned 3 matches of 3 total in 0.038 sec

Displaying matches:

1. Document=3, weight=24, published=Thu Apr 1 12:01:00 2010, author_id=2

2. Document=1, weight=4, published=Thu Apr 1 22:20:07 2010, author_id=1

3. Document=2, weight=3, published=Thu Apr 1 23:25:48 2010, author_id=1

Words:

1. 'twittter': 1 documents, 3 hits

two。 'and': 3 documents, 15 hits

3. 'opera': 1 documents, 25 hits

4. 'du': 2 documents, 4 hits

5. 'provide': 0 documents, 0 hits

6. 'Rea': 3 documents, 18 hits

7. 'search': 2 documents, 5 hits

8. 'Service': 1 documents, 1 hits

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

# # the following are the prompts for enabling the search service normally: (similar to csft-4.0 version)

Coreseek Fulltext 3.2 [Sphinx 0.9.9-release (r2117)]

Copyright (c) 2007-2010

Beijing Choice Software Technologies Inc (http://www.coreseek.com)

Using config file 'etc/csft.conf'...

Listening on all interfaces, port=9312

Third, configure coreseek to support mysql data sources

1, configure the csft_mysql.conf file

Copy the mysql configuration file to the coreseek installation directory etc/ (for example, / usr/local/coreseek/etc/)

Cp / usr/local/src/coreseek-3.2.14/testpack/etc/csft_mysql.conf / usr/local/coreseek/etc/

Cd / usr/local/coreseek/etc/

Vi csft_mysql.conf

You need to configure the red part below.

Official reference documentation: data source configuration: mysql data source http://www.coreseek.cn/products-install/datasource/

For other data sources, please refer to the official

=

# Source definition

Source phperz

{

Type = mysql

Sql_host = localhost

Sql_user = root

Sql_pass = xxxx

Sql_db = phperz

Sql_port = 3306

Sql_query_pre = SET NAMES utf8

Sql_query = SELECT id,title,descs,status from article

# sql_query the first column id should be an integer

# title and content are indexed by full text as string / text fields

Sql_attr_uint = status # the value read from SQL must be an integer

# sql_attr_timestamp = date_added # the value read from SQL must be an integer as a time attribute

Sql_query_info_pre = SET NAMES utf8 # set the correct character set when querying on the command line

Sql_query_info = SELECT * FROM article WHERE id=$id # when querying on the command line, read the original data information from the database

}

# index definition

Index phperz

{

Source = phperz # corresponding source name

Path = / usr/local/coreseek/var/data/phperz # Please modify it to the absolute path actually used, for example: / usr/local/coreseek/var/...

Docinfo = extern

Mlock = 0

Morphology = none

Min_word_len = 1

Html_strip = 0

# configuration of Chinese word segmentation. For more information, please see http://www.coreseek.cn/products-install/coreseek_mmseg/

Charset_dictpath = / usr/local/mmseg3/etc/ # BSD, set in Linux environment, / symbol ending

# charset_dictpath = etc/ # Windows setting, / symbol ending, it is best to give an absolute path, for example: Cpurl _ peg _

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 = / usr/local/coreseek/var/log/searchd_mysql.pid # Please modify it to the absolute path actually used, for example: / usr/local/coreseek/var/...

Log = / usr/local/coreseek/var/log/searchd_mysql.log # Please modify it to the absolute path actually used, for example: / usr/local/coreseek/var/...

Query_log = / usr/local/coreseek/var/log/query_mysql.log # Please modify it to the absolute path actually used, for example: / usr/local/coreseek/var/...

}

=

2, build an index

The scripture section needs to be changed to your own address.

/ usr/local/coreseek/bin/indexer-c / usr/local/coreseek/etc/csft_mysql.conf-- all

Possible errors

ERROR: index 'phperz': sql_connect: Can't connect to local MySQL server through socket' / var/lib/mysql/mysql.sock' (2) (DSN=mysql://root:***@localhost:3306/phperz)

This is because the sock file of mysql is not routed correctly.

Confirm your mysql.sock path and establish a soft connection, such as

Ln-s / tmp/mysql.sock / var/lib/mysql/mysql.sock

Fourth, the use of coreseek+php

Copy the / usr/local/src/coreseek-3.2.14/testpack/api/sphinxapi.php file recorded by the installation to your project

In your program, include sphinxapi.php

For instructions on how to use php, see / usr/local/src/coreseek-3.2.14/testpack/api/test.php

My usage is also attached:

=

$wd = trim ($_ GET ['wd'])

Include_once (JF_PATH. "/ config/sph_cfg.php"

Include_once (JF_PATH. "/ include/sphinxapi.php"

$cl = new SphinxClient ()

$cl- > SetServer (SPH_SERVER_HOST, SPH_SERVER_POST)

$cl- > SetConnectTimeout (3)

$cl- > SetArrayResult (true)

$cl- > SetMatchMode (1)

$cl- > SetFilter ("status", array (1))

$cl- > SetLimits (0,10)

$res = $cl- > Query ($wd, "phperz_www")

If ($res ['matches']) {

$rownum = $res ['total']

Foreach ($res ['matches'] as $k = > $v) {

$re = $this- > db- > get_one ("select * from article where id=". $v ['id'])

If (! empty ($re)) {

$list [] = $re

}

}

}

Print_r ($list)

=

Fifth, coreseek daily maintenance

Start

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

Stop it

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

Build an index

/ usr/local/coreseek/bin/indexer-c / usr/local/coreseek/etc/csft_mysql.conf-- all

Rebuild the index

/ usr/local/coreseek/bin/indexer-c / usr/local/coreseek/etc/csft_mysql.conf-- all-- rotate

The above is how to install coreseek in centos. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report