Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use the latest version of the Sunspot gem with Solr Cell?

I've been trying (in vain) to get the latest version of the Sunspot gem (currently 2.0.0.pre.111215, incorporating Solr 3.5) working with Solr Cell.

Currently I am using the older version of Sunspot in combination with Solr Cell provided by the following plugin - https://github.com/chebyte/sunspot_cell.

My Gemfile for this configuration is as follows;

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

Unfortunately this older combination of Solr/Solr cell does not work with many newer PDF files. The recommended solution by Apache is to upgrade to the latest version of both.

The Sunspot Solr Cell bolt-on doesn't seem to be very well supported. The most recently updated version has been switched from a Plugin to a Gem, but I still can't get it to work with the latest version of the Sunspot Gem. https://github.com/zheileman/sunspot_cell

Does anyone know the correct Gemfile configuration to get the elements to play nicely together? The closest I have is this.

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

When I run any rake task I get the following error.

uninitialized constant Sunspot::RSolr

If I comment the sunspot_cell gem out temporarily, I can get Rake tasks to run but actual searching fails.

I've tried manually using the Solr jar files in this gem instead of the ones bundled in sunspot_solr but also without success.

like image 896
Simmo Avatar asked Jan 20 '12 14:01

Simmo


2 Answers

After a bit of trial and error, the answer to this turned out to be easier than I had hoped. The gems were apparently specified in the wrong order. I didn't realise it made any difference. I changed the order so that sunspot_cell was last and it burst into like. Magic! (almost).

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'
like image 62
Simmo Avatar answered Nov 03 '22 21:11

Simmo


Glad to know you already fixed it. This is my current setup. A pretty big mess of gems, I know =)

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"
like image 2
Zheileman Avatar answered Nov 03 '22 21:11

Zheileman