ThinkingSphinx connection error

Sergey Pozhidaev's Avatar

Sergey Pozhidaev

24 Jul, 2019 11:36 AM

Hi. I upgrade my project from rails 4 to rails 5 and ThinkingSphinx stopped working.
I get error when try to searching:
ThinkingSphinx::ConnectionError (Error connecting to Sphinx via the MySQL protocol. Can't connect to MySQL server on '127.0.0.1' (111))
Gem versions: gem 'flying-sphinx', '2.0'
gem 'mysql2', '~> 0.4.10'
gem 'thinking-sphinx', '~> 4.3'

Config thinking_sphynx.yml
production:
version: 3.1.1 morphology: stem_en indexed_models: - Title After deploy i execute bundle exec rake ts:rebuild

Thanks!

  1. 1 Posted by Sergey Pozhidae... on 24 Jul, 2019 11:43 AM

    Sergey Pozhidaev's Avatar

    I check Sphinx daemon - is loading

  2. Support Staff 2 Posted by Pat Allan on 24 Jul, 2019 12:13 PM

    Pat Allan's Avatar

    Hi Sergey,

    I’m not sure if it’s related, but can you try updating the flying-sphinx gem to the latest release (v2.1.4), and confirm thinking-sphinx is using 4.3.2?

  3. Support Staff 3 Posted by Pat Allan on 24 Jul, 2019 12:18 PM

    Pat Allan's Avatar

    Hi Sergey,

    Just looking at the gem releases, there was actually a bug fix in flying-sphinx v2.1.4 to ensure it works well with thinking-sphinx v4.2+, so I suspect that’s the problem, and upgrading the two gems to their latest releases will indeed fix the issue.

    Do let me know if that’s not the case, though!

    Kind regards,


    Pat

  4. 4 Posted by Sergey Pozhidae... on 25 Jul, 2019 06:36 AM

    Sergey Pozhidaev's Avatar

    I have an error after gems update:
    ThinkingSphinx::SphinxError (no enabled local indexes to search)

  5. Support Staff 5 Posted by Pat Allan on 25 Jul, 2019 06:38 AM

    Pat Allan's Avatar

    Hi Sergey,

    Can you confirm the name of your app so I can investigate more thoroughly?

    Cheers,


    Pat

  6. 6 Posted by Sergey Pozhidae... on 25 Jul, 2019 06:41 AM

    Sergey Pozhidaev's Avatar

    Flying Sphinx log

  7. 7 Posted by Sergey Pozhidae... on 25 Jul, 2019 06:45 AM

    Sergey Pozhidaev's Avatar

    My app name is stark-cloud-2613-pr-37
    Thanks!

  8. Support Staff 8 Posted by Pat Allan on 25 Jul, 2019 06:48 AM

    Pat Allan's Avatar

    There seems to be an odd error during the indexing… I’m not yet sure what the cause is, but I’ll keep investigating and let you know what I find.

  9. Support Staff 9 Posted by Pat Allan on 25 Jul, 2019 07:02 AM

    Pat Allan's Avatar

    Okay, it looks like a bug in Sphinx v3.1.1.
    http://sphinxsearch.com/forum/view.html?id=16081

    Thinking Sphinx configures Sphinx to only request 1024 records at a time, but it does that by min/max id values. e.g. 1-1024, then 1025-2048, 2049-3072, etc. If one of those min/max windows actually returns no records, this error occurs.
    http://sphinxsearch.com/docs/current.html#conf-sql-range-step

    You’ve got a few options to work around this…

    • Downgrade your Sphinx version to 2.2.11 (which will process your indices fine - I checked that manually).
    • Remove the ranged indexing, which means it requests all records at once (not great for performance) - this is done by adding set_property :disable_range? => true in your index definition.
    • Or, increase the range beyond 1024 to something significantly larger, using set_property :sql_range_step => 100_000 or similar. Depending on how many gaps are in your primary key values, you may still hit the bug!

    I recommend the first option, unless you know you’re only going to be dealing with small amounts of data (and then disabling the ranged queries is okay). It's a shame this bug exists, but hopefully there's a fixed release of Sphinx at some point soon.

  10. 10 Posted by Sergey Pozhidae... on 25 Jul, 2019 07:18 AM

    Sergey Pozhidaev's Avatar

    Great! It works. Thank you very much

  11. Support Staff 11 Posted by Pat Allan on 25 Jul, 2019 07:19 AM

    Pat Allan's Avatar

    No worries :)

  12. Pat Allan closed this discussion on 25 Jul, 2019 07:19 AM.

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