Search code examples
ruby-on-railsruby-on-rails-3sphinxthinking-sphinx

flying sphinx noMethodError => Undefined method 'generate'


I am pushing my site to heroku and am encountering a problem with flying-sphinx.

I implemented a working Thinking-Sphinx search functionality in development. It works just fine. i acquired flying-sphinx. However when I run:

heroku run flying-sphinx configure

I get the following error message:

Connecting to database specified by DATABASE_URL
/app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.5/lib/flying_sphinx/sphinx_configuration.rb:24:in `content': undefined method `generate' for #<ThinkingSphinx::Configuration:0x00000004648e90> (NoMethodError)
    from /app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.5/lib/flying_sphinx/sphinx_configuration.rb:8:in `upload_to'
    from /app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.5/lib/flying_sphinx/cli.rb:32:in `configure'
    from /app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.5/lib/flying_sphinx/cli.rb:20:in `block in run'
    from /app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.5/lib/flying_sphinx/cli.rb:20:in `each'
    from /app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.5/lib/flying_sphinx/cli.rb:20:in `all?'
    from /app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.5/lib/flying_sphinx/cli.rb:20:in `run'
    from /app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.5/bin/flying-sphinx:5:in `<top (required)>'
    from /app/bin/flying-sphinx:19:in `load'
    from /app/bin/flying-sphinx:19:in `<main>

Here are the versions I use:

Rails 3.2.11
Thinking-Sphinx 3.0.2
Flying-Sphinx 0.8.5
MySQL2 0.3.12

(my db is running on PostGresql - the MySQL2 is solely for Sphinx)


Solution

  • I've worked through this issue with Laurent elsewhere, but the core of it is: the gem releases of flying-sphinx (up to 0.8.5) don't support Thinking Sphinx v3. I do have something ready for that, just waiting on other dependencies to merge some commits and release their own gem update.

    In the meantime, you can use the latest and greatest (and this will work with the latest versions of Thinking Sphinx across v1/v2/v3) via git:

    gem 'pusher-client',
      :git    => 'git://github.com/pat/pusher-ruby-client.git',
      :branch => 'catch-io',
      :ref    => '608cc28d1a'
    gem 'flying-sphinx',
      :git    => 'git://github.com/flying-sphinx/flying-sphinx.git',
      :branch => 'master',
      :ref    => 'e1395e724a'
    

    If you're using Ruby 1.8.7, you'll also need the following gem to cover some limitations of OpenSSL in the Standard Library:

    gem 'openssl-nonblock', '0.2.1'