coreseek sphinx rails3给力中文文档

 

http://tjcjc.iteye.com/blog/766863
http://tongxiaoming520.iteye.com/blog/844988
以上两篇都很给力
http://www.iteye.com/topic/487608
2010 - 09 - 19

mysql thinking_sphinx coreseek rails3

版本:coreseek 3.2.13   thinking_spinx 2.0.0.rc2 rails3.0.0

在linux下修改3个my.cnf的1个/etc/mysql/my.cnf文件

找到客户端配置[client] 在下面添加
default-character-set=utf8 默认字符集为utf8
在找到[mysqld] 添加
default-character-set=utf8 默认字符集为utf8
init_connect='SET NAMES utf8' (设定连接mysql数据库时使用utf8编码,以让mysql数据库为utf8运行)

修改好后,重新启动mysql 即可,
sudo /etc/init.d/mysql restart
查询一下show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

这样就不用每次连接 都使用  --default-character-set=utf8 了

安装:
coreseek
按照网站上的下载安装
thinking_sphinx
gem install --pre

配置:
gemfile中
gem 'thinking-sphinx', '2.0.0.rc2', :require => 'thinking_sphinx'
config/sphinx.yml中
development:
  charset_type: zh_ch.utf-8
  bin_path: coreseek的目录/bin
  charset_dictpath: mmseg3的目录/etc

使用:
model中
define_index do
indexes :introduction #model的一个字段 indexes就会检索这个字段
end

rails/app目录下
rake thinking_sphinx:configure
rake thinking_sphinx:index
rake thinking_sphinx:start

几个使用中出现的错误
1.
Sphinx cannot be found on your system. You may need to configure the following
settings in your config/sphinx.yml file:
  * bin_path
  * searchd_binary_name
  * indexer_binary_name
这个可以忽略 因为用的是coreseek 所以他会说没有找到sphinx

2.
index时
FATAL: index 'video_core': unknown charset type 'zh_cn.utf-8'
这个是因为没有在config/sphinx.yml中配置charset_dictpath

3.
start
Failed to start searchd daemon
这个是因为coreseek安装以后会自动运行 会有一个deamon的进程
需要kill掉它
ps -aef|gref deamon
kill 进程号
然后再rake start命令

4.Riddle cannot detect Sphinx on your machine, and so can't determine which
version of Sphinx you are planning on using. Please use one of the following
lines after "require 'riddle'" to avoid this warning.

  require 'riddle/0.9.8'
  # or
  require 'riddle/0.9.9'
  # or
  require 'riddle/1.10'
这个警告也可以忽略

5.每次更新了数据都需要重新index一遍 但是不需要restart 他会自动更新   

 

posted on 2011-08-17 23:13  lexus 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/lexus/archive/2011/08/17/2143760.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值