Home Database Mysql Tutorial coreseek sphinx mmseg mysql 全文检索 安装 配置

coreseek sphinx mmseg mysql 全文检索 安装 配置

Jun 07, 2016 pm 04:37 PM
coreseek mysql sphinx

上次搞全文检索的东西 ,还要追溯到2010了,当时个人觉得coreseek还不成熟,就用了原始的sphinx,请参考: sphinx mmseg mysql 中文分词 ,这次呢,决定用一下coreseek,看看有什么区别。 一,安装环境和工具 服务器用的是centos6.5 x86 coreseek 4.0.1下载

上次搞全文检索的东西 ,还要追溯到2010了,当时个人觉得coreseek还不成熟,就用了原始的sphinx,请参考:sphinx mmseg mysql 中文分词,这次呢,决定用一下coreseek,看看有什么区别。

一,安装环境和工具

服务器用的是centos6.5 x86

coreseek 4.0.1下载地址:http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.0.1-beta.tar.gz

mysql 5.5.8下载地址:http://downloads.mysql.com/archives/community/

二,mmseg中文分词安装

1,旧版本安装方法

# tar zxvf coreseek-4.0.1-beta
# cd coreseek-4.0.1-beta/mmseg-3.2.14/
# aclocal
# libtoolize --force
# automake --add-missing
# autoconf
# autoheader
# make clean
# ./configure --prefix=/usr/local/mmseg3
# make
# make install
Copy after login

2,新版本安装方法

# ./bootstrap
# ./configure --prefix=/usr/local/mmseg3
# make
# make install
Copy after login

mmseg-3.2.14,二种方法都可以安装成功,在编译时有报warning,但不影响安装。

3,新版本mmseg安装后,分词的东西就好了,不要用mmseg去生成了

[root@localhost mmseg-3.2.14]# ll /usr/local/mmseg3/etc/
总用量 5432
-rwxr-xr-x 1 root root 229 7月 31 01:44 mmseg.ini
-rwxr-xr-x 1 root root 1826251 7月 31 01:44 unigram.txt
-rwxr-xr-x 1 root root 3729280 7月 31 01:44 uni.lib
Copy after login

4,mmseg.ini配置的官方说明

[mmseg]
merge_number_and_ascii=0; #合并英文和数字 abc123/x
number_and_ascii_joint=-; #定义可以连接英文和数字的字符
compress_space=1;         #暂不支持
seperate_number_ascii=0; #就是将字母和数字打散
Copy after login

三,csft(sphinx)安装

1,旧版安装

# cp /coreseek的解压目录/mmseg-3.2.14/src/*/*.h /usr/local/mmseg3/include/mmseg/
# cd /home/tank/download/coreseek-4.0.1-beta
# aclocal
# libtoolize --force
# automake --add-missing
# autoconf
# autoheader
# perl -pi -e 's/lpthread/lpthread -liconv/g' src/Makefile*
# make clean
# ./configure --prefix=/usr/local/sphinx --enable-id64 \
--with-mysql=/usr/local/mysql2 --with-mmseg \
--with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ \
--with-mmseg-libs=/usr/local/mmseg3/lib/
# make && make install
Copy after login

2,新版安装

# cd /home/tank/download/coreseek-4.0.1-beta
# ./buildconf.sh
# ./configure --prefix=/usr/local/sphinx --enable-id64 \
--with-mysql=/usr/local/mysql2 --with-mmseg \
--with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ \
--with-mmseg-libs=/usr/local/mmseg3/lib/
# make && make install
Copy after login

coreseek-4.0.1,二种安装方式都是可以的,但是安装时,还是会报错。

四,mysql插件 sphinxse的安装

1,将mysqlse复制到mysql程序目录storage

# cp -R coreseek-4.0.1-beta/csft-4.0.1-beta/mysqlse /home/tank/download/mysql-5.5.8/storage/sphinx
Copy after login

2,cmake安装mysql 5.5.8

#cd /home/tank/download/mysql-5.5.8
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql2 \
 -DMYSQL_UNIX_ADDR=/usr/local/mysql2/mysql.sock \
 -DCMAKE_BUILD_TYPE=Release -DWITH_SPHINX_STORAGE_ENGINE=1 \
 -DDEFAULT_CHARSET=utf8 \
 -DDEFAULT_COLLATION=utf8_general_ci \
 -DWITH_MYISAM_STORAGE_ENGINE=1 \
 -DWITH_INNOBASE_STORAGE_ENGINE=1 \
 -DWITH_MEMORY_STORAGE_ENGINE=1 \
 -DWITH_READLINE=1 \
 -DENABLED_LOCAL_INFILE=1 \
 -DMYSQL_DATADIR=/usr/local/mysql2/data \
 -DMYSQL_USER=mysql
# make && make install
Copy after login

cmake安装mysql高版本,请参考:linux cmake 安装mysql5.5.11,以及更高版本

3,configure安装mysql5.5.8

# cd /home/tank/download/mysql-5.5.8
# sh BUILD/autorun.sh
# ./configure --prefix=/usr/local/mysql2 \
--with-plugins=partition,innobase,myisam,sphinx \
--with-charset=utf8
# make && make install
Copy after login

4,初始化数据库

# cd /home/tank/download/mysql-5.5.8
# chmod +x scripts/mysql_install_db
# scripts/mysql_install_db --basedir=/usr/local/mysql2 \ #初始化数据
--datadir=/usr/local/mysql2/data --user=mysql
# cp support-files/my-medium.cnf /etc/my.cnf #copy配置文件
# chown -R mysql:mysql /usr/local/mysql2 #更改权限 
# vim /etc/my.cnf      #加上以下内容
[mysqld]
basedir = /usr/local/mysql2
datadir = /usr/local/mysql2/data
log-error = /usr/local/mysql2/mysql_error.log
pid-file = /usr/local/mysql2/mysql.pid
user = mysql
tmpdir = /tmp
Copy after login

5,启动并登录mysql

# cd /usr/local/mysql2/support-files/
# cp ./mysql.server /etc/init.d/mysql5
# /etc/init.d/mysql5 start              #启动服务端
# /usr/local/mysql2/bin/mysql           #客户端连接
Copy after login

6,启用sphinxse

sphinxse

sphinxse

在这里和以前安装sphinxse,有一点不同的是,以前mysql编译安装好了以后,就会有,不用在用root登录去install了。

五,配置sphinx.conf

# cd /usr/local/mysql2/support-files/
# cp ./mysql.server /etc/init.d/mysql5
# /etc/init.d/mysql5 start
# cd /usr/local/sphinx/etc
# cp sphinx.conf.dist sphinx.conf
# vim sphinx.conf 
source src1
{
 type = mysql
 sql_host = localhost
 sql_user = root //用名改一下
 sql_pass = 111111 //密码改一下,无密码,留空
 sql_db = test
 sql_query_pre = SET NAMES utf8 //这行注释去掉
 。。。。。。。。。。。省略。。。。。。。。。。。。。。
}
。。。。。。。。。。。省略。。。。。。。。。。。。。。
index rt //在index里面添加以下三行,加入中文分词功能
{
 type = rt
 path = /usr/local/sphinx/var/data/rt
 charset_dictpath = /usr/local/mmseg3/etc/ //添加
 charset_type = zh_cn.utf-8 //添加
 ngram_len = 0 //添加
 rt_field = title
 rt_field = content
 rt_attr_uint = gid
}
。。。。。。。。。。。省略。。。。。。。。。。。。。。
Copy after login

六,启动sphinx

//启动indexer
[root@localhost etc]# /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/sphinx.conf --all
Coreseek Fulltext 4.0 [ Sphinx 1.11-id64-dev (r2540)]
Copyright (c) 2007-2011,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)
 using config file '/usr/local/sphinx/etc/sphinx.conf'...
indexing index 'test1'...
collected 4 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 4 docs, 193 bytes
total 0.012 sec, 15540 bytes/sec, 322.08 docs/sec
indexing index 'test1stemmed'...
collected 4 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 4 docs, 193 bytes
total 0.002 sec, 75097 bytes/sec, 1556.42 docs/sec
skipping non-plain index 'dist1'...
skipping non-plain index 'rt'...
total 6 reads, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
total 18 writes, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
//启动searchd
[root@localhost etc]# /usr/local/sphinx/bin/searchd --config /usr/local/sphinx/etc/sphinx.conf
Coreseek Fulltext 4.0 [ Sphinx 1.11-id64-dev (r2540)]
Copyright (c) 2007-2011,
Beijing Choice Software Technologies Inc (http://www.coreseek.com)
using config file '/usr/local/sphinx/etc/sphinx.conf'...
listening on all interfaces, port=9312
listening on all interfaces, port=9306
 precaching index 'test1'
precaching index 'test1stemmed'
WARNING: multiple addresses found for 'localhost', using the first one (ip=127.0.0.1)
precaching index 'rt'
precached 3 indexes in 0.001 sec
Copy after login
coreseek sphinx mmseg mysql 全文检索 安装 配置 上次搞全文检索的东西 ,还要追溯到2010了,当时个人觉得coreseek还不成熟,就用了原始的sphinx,请参考:sphinx mmseg mysql 中文分词,这次呢,决定用一下coreseek,看看有什么区别。 一,安装环境和工具 服务器用的是centos6.5 x86 coreseek 4.0.1下载地址:http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.0.1-beta.tar.gz mysql 5.5.8下载地址:http://downloads.mysql.com/archives/community/ 二,mmseg中文分词安装 1,旧版本安装方法 # tar zxvf coreseek-4.0.1-beta # cd coreseek-4.0.1-beta/mmseg-3.2.14/ # aclocal # libtoolize --force # automake --add-missing # autoconf # autoheader # make clean # ./configure --prefix=/usr/local/mmseg3 # make # make install 2,新版本安装方法 # ./bootstrap # ./configure --prefix=/usr/local/mmseg3 # make # make install mmseg-3.2.14,二种方法都可以安装成功,在编译时有报warning,但不影响安装。 3,新版本mmseg安装后,分词的东西就好了,不要用mmseg去生成了 [root@localhost mmseg-3.2.14]# ll /usr/local/mmseg3/etc/ 总用量 5432 -rwxr-xr-x 1 root root 229 7月 31 01:44 mmseg.ini -rwxr-xr-x 1 root root 1826251 7月 31 01:44 unigram.txt -rwxr-xr-x 1 [...]coreseek sphinx mmseg mysql 全文检索 安装 配置
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1264
29
C# Tutorial
1237
24
MySQL's Role: Databases in Web Applications MySQL's Role: Databases in Web Applications Apr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

Laravel Introduction Example Laravel Introduction Example Apr 18, 2025 pm 12:45 PM

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

MySQL and phpMyAdmin: Core Features and Functions MySQL and phpMyAdmin: Core Features and Functions Apr 22, 2025 am 12:12 AM

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

Solve database connection problem: a practical case of using minii/db library Solve database connection problem: a practical case of using minii/db library Apr 18, 2025 am 07:09 AM

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Laravel framework installation method Laravel framework installation method Apr 18, 2025 pm 12:54 PM

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

MySQL for Beginners: Getting Started with Database Management MySQL for Beginners: Getting Started with Database Management Apr 18, 2025 am 12:10 AM

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

Solve MySQL mode problem: The experience of using the TheliaMySQLModesChecker module Solve MySQL mode problem: The experience of using the TheliaMySQLModesChecker module Apr 18, 2025 am 08:42 AM

When developing an e-commerce website using Thelia, I encountered a tricky problem: MySQL mode is not set properly, causing some features to not function properly. After some exploration, I found a module called TheliaMySQLModesChecker, which is able to automatically fix the MySQL pattern required by Thelia, completely solving my troubles.

See all articles