首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >认为Sphinx搜索返回(对象不支持#inspect)

问认为Sphinx搜索返回(对象不支持#inspect)
EN

Stack Overflow用户
提问于 2013-05-01 23:31:01
回答 2查看 874关注 0票数 3

我在我的Rails3应用程序上安装了sphinx和thinking (3.0.2),在安装过程中一切似乎都运行得很好。我的最终计划是使用sphinx的geodist特性,但目前我只希望确保一切工作正常。

在我的模型- story.rb中,我有一个名为title的列,它是string类型的。因此,我在app/ in中创建了一个文件story_index.rb,其中包含:

代码语言:javascript
复制
ThinkingSphinx::Index.define :story, :with => :active_record do
  indexes title
end

我的rake ts:rebuild会生成以下内容:

代码语言:javascript
复制
Stopped searchd daemon (pid: 3185).
Generating configuration to /Users/kevin/Desktop/Development/grumpy/config/development.sphinx.conf
Sphinx 2.0.9-release (r3832)
Copyright (c) 2001-2013, Andrew Aksyonoff
Copyright (c) 2008-2013, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/Users/kevin/Desktop/Development/grumpy/config/development.sphinx.conf'...
indexing index 'story_core'...
collected 2 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 2 docs, 36 bytes
total 0.016 sec, 2189 bytes/sec, 121.63 docs/sec
total 3 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 9 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
Started searchd successfully (pid: 3222).

这看起来很好。但是,当我启动rails控制台并尝试:

代码语言:javascript
复制
1.9.3-p327 :001 > Story.search "dinosaur"
(Object doesn't support #inspect)
 =>  

到数据库的连接是正常的,并且有一些记录应该符合搜索标准。任何想法或解决方案都将非常受欢迎。:)

**使用GemFile更新**

代码语言:javascript
复制
gem 'jquery-rails', '2.0.2'

gem 'bootstrap-sass', '2.0.0'

gem 'devise', '2.1.2'

gem 'gon', '3.0.5'

gem 'resque', :require => 'resque/server'
gem 'resque-scheduler', :require => 'resque_scheduler'

gem 'thinking-sphinx', '3.0.2'

gem 'kaminari', '0.14.1'
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-05-02 23:55:01

正如评论中所讨论的,问题是使用旧版本的Sphinx (Sphinx v3使用它连接到Sphinx)。最低要求是0.3.12b4。

(对于那些感兴趣的人来说,为什么它没有被列为TS gem的依赖项,这是因为mysql2不能与JRuby一起工作)。

票数 4
EN

Stack Overflow用户

发布于 2013-06-17 10:50:51

在thinking-sphinx github页面上,它指出要在brew install sphinx --mysql中安装sphinx。这解决了我的问题,但在我使用postgres时破坏了我的索引。我的解决方案是brew install sphinx --mysql --pgsql,这允许我索引和搜索。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16321211

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档