我已经设置了 Thinking Sphinx gem https://github.com/pat/thinking-sphinx ,我正试图让它与 globalize https://github.com/globalize/globalize gem 一起工作。
我有一个名为 Content 的模型,它具有 :name、:body 、:summary 属性,并且还具有
translates :name, :body, :summary, :fallbacks_for_empty_translations => true
用于翻译。我创建了一个 content_index
ThinkingSphinx::Index.define :content, :with => :active_record do
indexes translations.summary, :sortable => true
indexes translations.body , :sortable => true
where "content_translations.locale = 'my_locale'"
end
当我做rake ts:index
或rake ts:rebuild
我得到
生成配置到 rails_app_path/config/development.sphinx.conf Sphinx 2.1.8-id64-release (rel21-r4675) 版权所有 (c) 2001-2014, Andrew Aksyonoff 版权所有 (c) 2008-2014, Sphinx Technologies Inc ( http:// /sphinxsearch.com)
使用配置文件'rails_app_path/config/development.sphinx.conf'...索引索引'content_core'...
收集了 43 个文档,0.0 MB
排序 0.0 Mhits,100.0% 完成
总共 43 个文档,3266 字节
总计 0.005 秒,616808 字节/秒,8120.86 文档/秒
跳过非普通索引“内容”...
总共 3 次读取,0.000 秒,1.3 kb/调用平均值,0.0 毫秒/调用平均值
总共 10 次写入,0.000 秒,1.5 kb/调用平均值,0.0 毫秒/调用平均值
旋转索引:成功发送 SIGHUP 到 searchd (pid=8282)。
因此,当我到达 rails 控制台(rails c)并尝试类似
内容.搜索“东西”
我得到空的结果。
2.1.2 :050 > Content.search("某事")
Sphinx 查询 (0.6ms) SELECT * FROM
content_core
WHERE MATCH('something') ANDsphinx_deleted
= 0 LIMIT 0, 20狮身人面像 找到 0 个结果
=> []
skipping non-plain index 'content'...
line in ts:rebuild
task和这个有关系吗?