undefined method 'generate'

lgorse's Avatar


03 Apr, 2013 12:53 AM

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)

  1. Support Staff 1 Posted by Pat Allan on 03 Apr, 2013 01:04 AM

    Pat Allan's Avatar

    Hi Laurent

    The issue is that there's not yet a gem release of flying-sphinx that supports TS v3. I've got the code all ready to go, I just need the Pusher team to update their pusher-client gem so the dependencies are all correct. In the meantime, you can use git references in your Gemfile instead:

    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    => '6dcf10b9d7'

    You will see a warning when the pusher-client gem is installed via git, due to a dodgy gemspec - I've also submitted a pull request to the Pusher team to get that fixed as well. It won't stop anything from working though.

    Sorry about the confusion!

    Any further questions, do let me know.


  2. Support Staff 2 Posted by Pat Allan on 03 Apr, 2013 01:06 AM

    Pat Allan's Avatar

    Autocorrect just mangled that branch name - it's catch-io, not catch-up (I've edited to fix, but the email notification won't have that change).

  3. 3 Posted by Ray Zeller on 03 Apr, 2013 05:27 AM

    Ray Zeller's Avatar

    Pat, I actually tried this an hour ago with the new gem and couldn't get the configuration file to load from thinking sphinx. Will paste the errors soon.

  4. 4 Posted by Ray Zeller on 03 Apr, 2013 07:24 AM

    Ray Zeller's Avatar

    Used these gems along with the ones you listed above:
    gem 'mysql2', '0.3.12b4' gem 'thinking-sphinx', '~> 3.0.2'

    getting these errors:
    /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:inload': no such file to load -- {id":1382111,"task":"index","status":"finished","data":"Sphinx 1.10-beta (r2420)\nCopyright (c) 2001-2010, Andrew Aksyonoff\nCopyright (c) 2008-2010, Sphinx Technologies Inc (http://sphinxsearch.com)\n\nusing config file '/mnt/local/flying-sphinx/56c0208264056d0c3/sphinx.conf'...\nindexing index 'store_core'...\ncollected 730 docs, 29.7 MB\nsorted 4.3 Mhits, 100.0% done\ntotal 730 docs, 29659505 bytes\ntotal 106.423 sec, 278692 bytes/sec, 6.85 docs/sec\ntotal 3 reads, 0.014 sec, 1645.8 kb/call avg, 4.9 msec/call avg\ntotal 17 writes, 0.086 sec, 600.3 kb/call avg, 5.0 msec/call avg\n","type (LoadError) from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in block in load' from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:inload_dependency' from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in load' from /app/vendor/bundle/ruby/1.9.1/bundler/gems/flying-sphinx-6dcf10b9d747/lib/flying_sphinx/action.rb:47:indebug' from /app/vendor/bundle/ruby/1.9.1/bundler/gems/pusher-ruby-client-608cc28d1aa8/lib/pusher-client/channel.rb:30:in call' from /app/vendor/bundle/ruby/1.9.1/bundler/gems/pusher-ruby-client-608cc28d1aa8/lib/pusher-client/channel.rb:30:inblock in dispatch' from /app/vendor/bundle/ruby/1.9.1/bundler/gems/pusher-ruby-client-608cc28d1aa8/lib/pusher-client/channel.rb:29:in each' from /app/vendor/bundle/ruby/1.9.1/bundler/gems/pusher-ruby-client-608cc28d1aa8/lib/pusher-client/channel.rb:29:indispatch' from /app/vendor/bundle/ruby/1.9.1/bundler/gems/pusher-ruby-client-608cc28d1aa8/lib/pusher-client/channel.rb:22:in dispatch_with_all' from /app/vendor/bundle/ruby/1.9.1/bundler/gems/pusher-ruby-client-608cc28d1aa8/lib/pusher-client/socket.rb:187:insend_local_event' from /app/vendor/bundle/ruby/1.9.1/bundler/gems/pusher-ruby-client-608cc28d1aa8/lib/pusher-client/socket.rb:71:in block (2 levels) in connect' from /app/vendor/bundle/ruby/1.9.1/bundler/gems/pusher-ruby-client-608cc28d1aa8/lib/pusher-client/socket.rb:65:inloop' from /app/vendor/bundle/ruby/1.9.1/bundler/gems/pusher-ruby-client-608cc28d1aa8/lib/pusher-client/socket.rb:65:in block in connect'

    when i try
    heroku run bundle exec flying-sphinx rebuild

    ThinkingSphinx::SyntaxError (syntax error, unexpected $undefined, expecting IDENT near 'store_coreWHERE MATCH('query @sphinx_internal_class_name (Store)') AND geodist BETWEEN 0.0 AND 241402.0 AND sphinx_deleted = 0 ORDER BY geodist ASC, @weight DESC LIMIT 0, 50; SHOW META'):

    when i try
    ThinkingSphinx.search('query') with geo_dist enabled.

  5. Support Staff 5 Posted by Pat Allan on 03 Apr, 2013 07:57 AM

    Pat Allan's Avatar

    Hi Ray

    The issue here is that you're using an old version of multi_json. In the one other case I've seen this happen, this is due to an old version of Capybara. I know multi_json 1.0.4 is bad, and 1.7.2 is good, but not quite sure which version introduced MultiJSON.load (which is what flying-sphinx requires). I'll have to update the gemspec accordingly. In the meantime, though, just run bundle update multi_json and see what version that gets you.

    Kind regards


  6. 6 Posted by Ray Zeller on 03 Apr, 2013 08:56 PM

    Ray Zeller's Avatar

    Thanks, Pat, that fixed everything.

  7. Pat Allan closed this discussion on 13 Jan, 2014 11:23 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac