六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 1260|回复: 0

CentOS5.5 安装 Sphinx 全文检索joolma

[复制链接]
 楼主| 发表于 2016-2-25 15:11:33 | 显示全部楼层 |阅读模式
CentOS5.5 安装 Sphinx 全文检索joolma
1. 下载Sphinx最新版 http://www.sphinxsearch.com/downloads.html

2. 安装
# tar -zxvf sphinx-0.9.9.tar.gz
# cd sphinx-0.9.9/
# ./configure --prefix=/usr/local/sphinx --with-mysql-includes=/usr/local/mysql/include/mysql/ --with-mysql-libs=/usr/local/mysql/lib/mysql --with-iconv
# make && make install



../depcomp: line 512: exec: g++: not found
make[2]: *** [my_new.o] 错误 127
make[2]: Leaving directory `/tmp/lamp/mysql-5.0.56/mysys'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/tmp/lamp/mysql-5.0.56'
make: *** [all] 错误 2
[root@localhost mysql-5.0.56]#

解决办法:
yum install -y gcc-c++

3. 配置
# cd /usr/local/sphinx/etc
# cp sphinx-min.conf.dist joomla.conf
# vi joomla.conf

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

source joomla_src
{
        type                   = mysql

        sql_host               = localhost
        sql_user               = root
        sql_pass               = 123456
        sql_db                 = joomla
        sql_port               = 3306  # optional, default is 3306

        sql_query              = SELECT * FROM jos_content

        sql_attr_uint          = id
        sql_attr_timestamp     = created

        sql_query_info         = SELECT * FROM jos_content WHERE id=$id
}


index joomla_index
{
        source                 = joomla_src
        path                   = /usr/local/sphinx/var/data/joomla_index
        docinfo                = extern
        charset_type           = utf-8
}


indexer
{
        mem_limit              = 32M
}


searchd
{
        port                   = 9312
        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        = 0
        unlink_old             = 1
}
保存退出

4. 建立索引
# /usr/local/sphinx/bin/indexer  --config joomla.conf  --all joomla_index

5. 启动sphinx后台服务
# /usr/local/sphinx/bin/searchd -c /usr/local/sphinx/etc/joomla.conf  -i joomla_index &

6. 测试
#/usr/local/php/bin/php-cgi test.php -h localhost -p 9312 -i joomla_index -ph title
X-Powered-By: PHP/5.2.10
Content-type: text/html

Query 'title ' retrieved 16 of 16 matches in 0.001 sec.
Query stats:
    'title' found 61 times in 16 documents

Matches:
1. doc_id=44, weight=2, created=1970-01-01 07:33:27
2. doc_id=1, weight=1, created=1970-01-01 07:33:28
3. doc_id=4, weight=1, created=1970-01-01 07:33:28
4. doc_id=5, weight=1, created=1970-01-01 07:33:28
5. doc_id=10, weight=1, created=1970-01-01 07:33:28
6. doc_id=11, weight=1, created=1970-01-01 07:33:28
7. doc_id=20, weight=1, created=1970-01-01 07:33:28
8. doc_id=21, weight=1, created=1970-01-01 07:33:28
9. doc_id=24, weight=1, created=1970-01-01 07:33:28
10. doc_id=25, weight=1, created=1970-01-01 07:33:28
11. doc_id=26, weight=1, created=1970-01-01 07:33:28
12. doc_id=27, weight=1, created=1970-01-01 07:33:28
13. doc_id=28, weight=1, created=1970-01-01 07:33:28
14. doc_id=30, weight=1, created=1970-01-01 07:33:28
15. doc_id=38, weight=1, created=1970-01-01 07:33:28
16. doc_id=45, weight=1, created=1970-01-01 07:33:27

   

CentOS5.5 安装 Sphinx 全文检索joolma

该会员没有填写今日想说内容.
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表