Can't search on heroku, but no errors on index

forrest's Avatar

forrest

Jun 22, 2013 @ 03:35 PM

I'm having a weird issue and am likely missing something, but would greatly appreciate any assistance.

Pushing to heroku, no errors.
Rebuilding on heroku, no errors.

Searching on heroku, I receive:
ThinkingSphinx::SyntaxError (syntax error, unexpected $undefined, expecting IDENT near '`matter_core` WHERE MATCH('@status initial @sphinx_internal_class_name (Matter)') AND national = 1 AND attorney_id = 0 AND sphinx_deleted = 0 AND matter_id NOT IN (5) ORDER BY updated_at ASC LIMIT 0, 5; SHOW META')

I'm using:
ThiningSphinx 3.0.3
FlyingSphinx from github: http://github.com/flying-sphinx/flying-sphinx.git

Everything is working fine locally. Any thoughts? I did tweak my matters index (though I should note I get the above error when trying to search on any index). Including matters index below:
ThinkingSphinx::Index.define :matter, :with => :active_record do
  indexes city, :sortable => true
  indexes description, :sortable => true
  indexes state, :sortable => true
  indexes status
  indexes actions.name, :as => :action_name
  indexes actions.notes, :as => :notes
  indexes actions.attorney_id, :as => :action_attorney_id

  has attorney_id
  has created_at
  has :id, :as => :matter_id
  has updated_at
  has national
  has "RADIANS(latitude)", :as => :latitude, :type => :float
  has "RADIANS(longitude)", :as => :longitude, :type => :float
  group_by "latitude", "longitude"
end

Thanks in advance!

  1. 1 Posted by forrest on Jun 22, 2013 @ 07:42 PM

    forrest's Avatar

    Is it possible this is related to attempting to roll out ts_delayed_deltas? I tried earlier to roll this out in staging and when it didn't work as expected I went back to the index above, but now cannot search...

  2. 2 Posted by forrest on Jun 22, 2013 @ 08:13 PM

    forrest's Avatar

    And I get an even more generalized error when doing a basic query:
    Matter.search

    ThinkingSphinx::SyntaxError: syntax error, unexpected $undefined, expecting IDENT near '`matter_core` WHERE MATCH('@sphinx_internal_class_name (Matter)') AND sphinx_deleted = 0 LIMIT 0, 20; SHOW META'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/connection.rb:78:in `query'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/connection.rb:78:in `query_all'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/search/batch_inquirer.rb:17:in `block in results'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/connection.rb:37:in `block in take'
            from /app/vendor/bundle/ruby/1.9.1/gems/innertube-1.0.2/lib/innertube.rb:127:in `take'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/connection.rb:35:in `take'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/search/batch_inquirer.rb:16:in `results'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/middlewares/inquirer.rb:9:in `block in call'
            from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
            from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
            from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/search/context.rb:22:in `log'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/middlewares/inquirer.rb:8:in `call'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/middlewares/geographer.rb:9:in `call'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/middlewares/sphinxql.rb:13:in `call'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/middlewares/stale_id_filter.rb:10:in `call'
            from /app/vendor/bundle/ruby/1.9.1/gems/middleware-0.1.0/lib/middleware/runner.rb:31:in `call'
            from /app/vendor/bundle/ruby/1.9.1/gems/middleware-0.1.0/lib/middleware/builder.rb:102:in `call'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/search.rb:65:in `populate'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/search.rb:106:in `method_missing'
            from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
            from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'

  3. Support Staff 3 Posted by Pat Allan on Jun 23, 2013 @ 02:21 AM

    Pat Allan's Avatar

    Hi Forrest

    Sorry for not getting back to you sooner on this. I'm just looking at the server now, and I've run a basic test query against your daemon and it's working:

    SELECT * FROM matter_core WHERE MATCH('@sphinx_internal_class_name (Matter)') AND sphinx_deleted = 0 LIMIT 0, 20

    But also, I've noticed the daemon's been running for almost two weeks since it's last restart - which is fine, but if you've made changes to the index structure (especially adding in deltas) then you'll need to rebuild your Sphinx setup (heroku run bundle exec flying-sphinx rebuild).

    HOWEVER: this is me looking at your production site (lexspot2) - is the issue on staging or production?

    --
    Pat

  4. 4 Posted by forrest on Jun 23, 2013 @ 06:46 AM

    forrest's Avatar

    Sorry for not clarifying earlier -- these issues are on lexspot2-staging and I've rebuilt numerous times in the last 24 hours.

    Let me know if you see anything interesting there.

    Forrest

    Sent from my mobile.

    On Jun 22, 2013, at 19:21, "Pat Allan" <[email blocked]> wrote:

  5. Support Staff 5 Posted by Pat Allan on Jun 23, 2013 @ 08:53 AM

    Pat Allan's Avatar

    Hi Forrest

    What's the search call you're running that gets this error? Can you tail your logs and see what the generated SphinxQL statement is?

    --
    Pat

  6. 6 Posted by forrest on Jun 23, 2013 @ 02:53 PM

    forrest's Avatar

    Hi Pat,

    I can't get any searches to run successfully. For example, `Matter.search`, `ThinkingSphinx.search`, and `Matter.search "citizen"` all fail with the same message from the command line. In the app itself, this is the query that's specifically causing issues:

    ThinkingSphinx::SyntaxError (syntax error, unexpected $undefined, expecting IDENT near '`matter_core` WHERE MATCH('@status initial @sphinx_internal_class_name (Matter)') AND national = 1 AND attorney_id = 0 AND sphinx_deleted = 0 AND matter_id NOT IN (5) ORDER BY updated_at ASC LIMIT 0, 5; SHOW META'):

    In development, where the page in question loads (against just ts):
    SELECT * FROM `matter_core` WHERE MATCH('@status initial @sphinx_internal_class_name (Matter)') AND national = 1 AND attorney_id = 0 AND sphinx_deleted = 0 AND matter_id NOT IN (1, 2, 3) ORDER BY updated_at ASC LIMIT 0, 5

    Full trace when running from console:
    irb(main):005:0* ThinkingSphinx.search
    ThinkingSphinx::SyntaxError: syntax error, unexpected $undefined, expecting IDENT near '`category_core`, `frequently_asked_question_core`, `matter_core` WHERE sphinx_deleted = 0 LIMIT 0, 20; SHOW META'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/connection.rb:78:in `query'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/connection.rb:78:in `query_all'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/search/batch_inquirer.rb:17:in `block in results'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/connection.rb:37:in `block in take'
            from /app/vendor/bundle/ruby/1.9.1/gems/innertube-1.0.2/lib/innertube.rb:127:in `take'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/connection.rb:35:in `take'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/search/batch_inquirer.rb:16:in `results'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/middlewares/inquirer.rb:9:in `block in call'
            from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
            from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
            from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/search/context.rb:22:in `log'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/middlewares/inquirer.rb:8:in `call'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/middlewares/geographer.rb:9:in `call'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/middlewares/sphinxql.rb:13:in `call'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/middlewares/stale_id_filter.rb:10:in `call'
            from /app/vendor/bundle/ruby/1.9.1/gems/middleware-0.1.0/lib/middleware/runner.rb:31:in `call'
            from /app/vendor/bundle/ruby/1.9.1/gems/middleware-0.1.0/lib/middleware/builder.rb:102:in `call'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/search.rb:65:in `populate'
            from /app/vendor/bundle/ruby/1.9.1/gems/thinking-sphinx-3.0.3/lib/thinking_sphinx/search.rb:106:in `method_missing'
            from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
            from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
            from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
            from script/rails:6:in `require'
            from script/rails:6:in `<main>'irb(main):006:0> ^C

  7. Support Staff 7 Posted by Pat Allan on Jun 23, 2013 @ 03:50 PM

    Pat Allan's Avatar

    Ah, took a bit of hunting down, but I found it - your current Sphinx version (on Flying Sphinx) is 1.10, which isn't going to work with Thinking Sphinx v3. I'd recommend adding `version: '2.0.6'` to your config/thinking_sphinx.yml file for both staging and production, and then run a rebuild on staging and that should do the trick.

    Let me know if there's further issues.

  8. 8 Posted by forrest on Jun 23, 2013 @ 04:09 PM

    forrest's Avatar

    Wow. Thanks, Pat. At some point yesterday I had set the versions in thinking_sphinx.yml to 3.0.3, presumably to match the gem version. Didn't catch this change when I was trying to walk everything back to a working state.

    Thanks again!

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

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

Keyboard shortcuts

Generic

? 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