Install and configure the Chinese search for sphenders

Source: Internet
Author: User

SphinxInstallation and Application

1. Installation

ReferenceHttp://www.coreseek.cn/docs/coreseek_4.1-sphinx_2.0.1-beta.html#supported-system

$ Tar xzvf sphinx-2.0.1-beta.tar.gz
$ Cd sphinx

1. First install MMSeg:

$ Cd mmseg

$./Configure -- prefix =/usr/local/mmseg

$ Make

$ Make install

$ Cd ..

2. Run the configuration program:

$./Configure

The configure program has many running options. You can use the -- help switch to obtain the complete list. The most important thing is as follows:

-- Prefix, which defines the location where Coreseek is installed. For example, -- prefix =/usr/local/sphinx (all the examples below assume that Coreseek is installed in this location)

-- With-mysql: When automatic detection fails, you must specify where the MySQL header file and library file can be found;

-- With-pgsql indicates that PostgreSQL header files and library files can be found there.

-- With-mmseg: Enable the Chinese Word Segmentation Method Based on MMSeg, and point out that the MMSeg header file and library file can be found there.

-- With-python: enables Python data source support. You must install python2.6in advance.

3. Compile the source code to generate a binary program:

$ Make

4. Install the binary program to the directory you set: (IN Unix-like operating systems, the default value is/usr/local/bin/, but the installation directory can be modified by./configure -- prefix)

$ Make install


II.Configuration

[Zdh @ gy03 etc] # cat/usr/local/sphinx/etc/movie. conf

#

# Minimal Sphinx configuration sample (clean, simple, functional)

#


Source movie

{

Type = mysql


SQL _host = dbIP

SQL _user = dbuser

SQL _pass = dbpassword

SQL _db = dbname

SQL _port = 3306 # optional, default is 3306

SQL _query_pre = SET NAMES utf8

SQL _query = \

SELECT index_id, movie_id, movie_name, movie_name_alias, alias, starin, starin_pinyin, director, director_pinyin, movie_type, show_time, region, IFNULL (ABS (TO_DAYS (show_time) -TO_DAYS (now (), 187375) as near, weight \

FROM index_movie


SQL _attr_uint = movie_id

SQL _attr_uint = near

SQL _attr_uint = weight

# SQL _attr_timestamp = show_time

# SQL _attr_str2ordinal = movie_name


SQL _query_info = SELECT movie_id, movie_name, starin, director, movie_type, show_time, region FROM index_movie WHEREindex_id = $ id

}



Index movie

{

Source = movie

Path =/usr/local/sphinx/var/data/movie

Charset_type = UTF-8

Charset_table = 0 .. 9, .. z-> .. z, _, .. z, U + 410 .. U + 42F-> U + 430 .. U + 44F, U + 430 .. U + 44F

# Morphology = none

Chinese_dictionary =/usr/local/sphtionary/etc/xdict

# Min_stemming_len = 1

# Ngram_len = 1

# Min_word_len = 2

Ngram_chars = U + 3000 .. U + 2FA1F

}

Indexer

{

Mem_limit = 32 M

}

Searchd

{

Listen = 9312.

# Listen = 9306: mysql41

Log =/usr/local/sphinx/var/log/searchd. log

Query_log =/usr/local/sphinx/var/log/query. log

Read_timeout = 5

Max_children = 30

Pid_file =/usr/local/sphinx/var/log/searchd. pid

Max_matches = 1000

Seamless_rotate = 1

Preopen_indexes = 1

Unlink_old = 1

Workers = threads # for RT to work

Binlog_path =/usr/local/sphinx/var/data

}


3..Start and create an index

[Zdh @ gy03 etc] # searchd-c etc/movie. conf #Start

[Zdh @ gy03 etc] # searchd-c etc/movie. conf -- stop #Close


InCrontabAdd the following content to make it updated regularly

# Sphsf-indexer

00 06 ***/usr/local/bin/indexer-c/usr/local/sphinx/etc/movie. conf movie -- rotate



This article is from the "linuxblind open space" blog. For more information, contact the author!

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.