Skip to content

Instantly share code, notes, and snippets.

@seancribbs
Last active August 29, 2015 14:10
Show Gist options
  • Save seancribbs/52af4d838f376d745513 to your computer and use it in GitHub Desktop.
Save seancribbs/52af4d838f376d745513 to your computer and use it in GitHub Desktop.
$ bin/rails console
Loading development environment (Rails 4.1.7)
irb(main):001:0> Article.search_for_ids "crisis"
Sphinx Query (3.0ms) SELECT * FROM `article_core` WHERE MATCH('crisis') AND `sphinx_deleted` = 0 LIMIT 0, 20
(Object doesn't support #inspect)
=>
irb(main):002:0> _.to_a
Sphinx Retrying query "SELECT * FROM `article_core` WHERE MATCH('crisis') AND `sphinx_deleted` = 0 LIMIT 0, 20; SHOW META" after error: Lost connection to MySQL server during query - SELECT * FROM `article_core` WHERE MATCH('crisis') AND `sphinx_deleted` = 0 LIMIT 0, 20; SHOW META
Sphinx Query (1.7ms) SELECT * FROM `article_core` WHERE MATCH('crisis') AND `sphinx_deleted` = 0 LIMIT 0, 20
NoMethodError: undefined method `inject' for nil:NilClass
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/middlewares/inquirer.rb:49:in `call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/middlewares/inquirer.rb:14:in `block in call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/middlewares/inquirer.rb:13:in `each'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/middlewares/inquirer.rb:13:in `call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/middlewares/geographer.rb:11:in `call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/middlewares/sphinxql.rb:14:in `call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/middleware-0.1.0/lib/middleware/runner.rb:31:in `call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/middleware-0.1.0/lib/middleware/builder.rb:102:in `call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/search.rb:67:in `populate'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/search.rb:91:in `to_a'
from (irb):2
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands/console.rb:90:in `start'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands/console.rb:9:in `start'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands/commands_tasks.rb:69:in `console'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'irb(main):003:0> res = Article.search "cemetery"
Sphinx Retrying query "SELECT * FROM `article_core` WHERE MATCH('cemetery') AND `sphinx_deleted` = 0 LIMIT 0, 20; SHOW META" after error: Lost connection to MySQL server during query - SELECT * FROM `article_core` WHERE MATCH('cemetery') AND `sphinx_deleted` = 0 LIMIT 0, 20; SHOW META
Sphinx Query (2.0ms) SELECT * FROM `article_core` WHERE MATCH('cemetery') AND `sphinx_deleted` = 0 LIMIT 0, 20
(Object doesn't support #inspect)
=>
irb(main):004:0> res.populated?
=> nil
irb(main):005:0> res.meta
Sphinx Retrying query "SELECT * FROM `article_core` WHERE MATCH('cemetery') AND `sphinx_deleted` = 0 LIMIT 0, 20; SHOW META" after error: Lost connection to MySQL server during query - SELECT * FROM `article_core` WHERE MATCH('cemetery') AND `sphinx_deleted` = 0 LIMIT 0, 20; SHOW META
Sphinx Query (2.1ms) SELECT * FROM `article_core` WHERE MATCH('cemetery') AND `sphinx_deleted` = 0 LIMIT 0, 20
NoMethodError: undefined method `inject' for nil:NilClass
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/middlewares/inquirer.rb:49:in `call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/middlewares/inquirer.rb:14:in `block in call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/middlewares/inquirer.rb:13:in `each'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/middlewares/inquirer.rb:13:in `call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/middlewares/geographer.rb:11:in `call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/middlewares/sphinxql.rb:14:in `call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/middlewares/stale_id_filter.rb:10:in `call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/middleware-0.1.0/lib/middleware/runner.rb:31:in `call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/middleware-0.1.0/lib/middleware/builder.rb:102:in `call'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/search.rb:67:in `populate'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/thinking-sphinx-3.1.2/lib/thinking_sphinx/search.rb:46:in `meta'
from (irb):5
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands/console.rb:90:in `start'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands/console.rb:9:in `start'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands/commands_tasks.rb:69:in `console'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/sean/dev/kckcc/morgue/vendor/bundle/ruby/2.1.0/gems/railties-4.1.7/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'irb(main):006:0> ThinkingSphinx.search "crisis"
Sphinx Retrying query "SELECT * FROM `article_core` WHERE MATCH('crisis') AND `sphinx_deleted` = 0 LIMIT 0, 20; SHOW META" after error: Lost connection to MySQL server during query - SELECT * FROM `article_core` WHERE MATCH('crisis') AND `sphinx_deleted` = 0 LIMIT 0, 20; SHOW META
Sphinx Query (1.5ms) SELECT * FROM `article_core` WHERE MATCH('crisis') AND `sphinx_deleted` = 0 LIMIT 0, 20
(Object doesn't support #inspect)
=>
$ bin/rake ts:rebuild
Stopped searchd daemon (pid: 12827).
Generating configuration to /Users/sean/dev/kckcc/morgue/config/development.sphinx.conf
Sphinx 2.2.5-id64-release (r4825)
Copyright (c) 2001-2014, Andrew Aksyonoff
Copyright (c) 2008-2014, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file '/Users/sean/dev/kckcc/morgue/config/development.sphinx.conf'...
WARNING: key 'sql_query_info' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: key 'charset_type' was permanently removed from Sphinx configuration. Refer to documentation for details.
indexing index 'article_core'...
collected 17300 docs, 0.8 MB
sorted 0.1 Mhits, 100.0% done
total 17300 docs, 831678 bytes
total 0.159 sec, 5207230 bytes/sec, 108317.26 docs/sec
skipping non-plain index 'article'...
total 17306 reads, 0.011 sec, 0.1 kb/call avg, 0.0 msec/call avg
total 12 writes, 0.001 sec, 250.7 kb/call avg, 0.0 msec/call avg
Started searchd successfully (pid: 26524).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment