5

我一直在尝试(徒劳地)让最新版本的 Sunspot gem(当前为 2.0.0.pre.111215,包含 Solr 3.5)与 Solr Cell 一起使用。

目前,我正在使用旧版本的 Sunspot 与以下插件提供的 Solr Cell - https://github.com/chebyte/sunspot_cell

此配置的我的 Gemfile 如下;

gem 'sunspot', '1.2.1'
gem 'sunspot_rails' 

不幸的是,这种较旧的 Solr/Solr 单元组合不适用于许多较新的 PDF 文件。Apache 推荐的解决方案是升级到两者的最新版本。

Sunspot Solr Cell 螺栓连接似乎没有得到很好的支持。最近更新的版本已从插件切换到 Gem,但我仍然无法让它与最新版本的 Sunspot Gem 一起使用。https://github.com/zheileman/sunspot_cell

有谁知道正确的 Gemfile 配置以使元素一起很好地发挥作用?我最接近的是这个。

gem 'sunspot_cell', :git => 'git://github.com/zheileman/sunspot_cell.git'
gem 'sunspot', :git => "git://github.com/sunspot/sunspot.git"
gem 'sunspot_rails', :git => "git://github.com/sunspot/sunspot.git", :require => "sunspot_rails"

group :development, :test do
  gem 'sunspot_solr', :git => "git://github.com/sunspot/sunspot.git"
end

当我运行任何 rake 任务时,我收到以下错误。

uninitialized constant Sunspot::RSolr

如果我暂时将 sunspot_cell gem 注释掉,我可以让 Rake 任务运行,但实际搜索会失败。

我已经尝试在这个 gem中手动使用 Solr jar 文件,而不是 sunspot_solr 中捆绑的那些,但也没有成功。

4

2 回答 2

4

经过一番反复试验,结果证明这个问题的答案比我希望的要容易。这些宝石显然是按错误的顺序指定的。我没有意识到这有什么不同。我改变了顺序,所以 sunspot_cell 是最后一个,它突然变成了喜欢。魔法!(几乎)。

gem 'sunspot', :git => "git://github.com/sunspot/sunspot.git"
gem 'sunspot_rails', :git => "git://github.com/sunspot/sunspot.git", :require => "sunspot_rails"
gem 'sunspot_cell', :git => 'git://github.com/zheileman/sunspot_cell.git'
于 2012-01-20T14:53:15.917 回答
2

很高兴知道你已经修好了。这是我目前的设置。一大堆宝石,我知道 =)

gem 'rsolr', :git => 'git://github.com/mwmitchell/rsolr', :branch => "38b5b69a0d63cdf85560806c06f3187ea4339f5a" # 1.0.6 plus the timeout patch
gem 'sunspot'
gem 'sunspot_solr'
gem 'sunspot_rails'
gem 'sunspot_index_queue'
gem 'sunspot_cell', :git => 'git://github.com/zheileman/sunspot_cell.git', :branch => "bc8ac18de1410b3e29af89c4d028acc6deba1e1c"
于 2012-01-20T17:09:49.047 回答