pat / thinking-sphinx

Sphinx/Manticore plugin for ActiveRecord/Rails
http://freelancing-gods.com/thinking-sphinx
MIT License
1.63k stars 470 forks source link

rake ts:index empty output #1167

Closed petropush closed 3 years ago

petropush commented 4 years ago

Hello

When I run rake ts:index it returns nothing, only some warnings from my app. I'm using PostgreSQL + Octopus, Ruby 2.4.1, Sphinx 2.2.9, ActiveRecord 5.0.4, PostgreSQL 9.5.19 Can you please direct me where to start to investigate.

Index app/indices/group_index.rb

ThinkingSphinx::Index.define :group, :with => :active_record  do
  indexes name
  indexes desc
end

Thanks

pat commented 4 years ago

Hmm… what's the output when you run searchd on the command line, with no arguments?

petropush commented 4 years ago
Sphinx 2.2.9-id64-release (rel22-r5006)
Copyright (c) 2001-2015, Andrew Aksyonoff
Copyright (c) 2008-2015, Sphinx Technologies Inc (http://sphinxsearch.com)

FATAL: no readable config file (looked in /etc/sphinxsearch/sphinx.conf, ./sphinx.conf).
pat commented 4 years ago

That seems correct to me. What if you run rake --trace ts:rebuild?

Also, I presume you've got the mysql2 gem in your Gemfile as well? And which version of Thinking Sphinx are you using?

petropush commented 4 years ago

Also, I presume you've got the mysql2 gem in your Gemfile as well? And which version of Thinking Sphinx are you using?

thinking-sphinx (4.4.1) and mysql2 (0.5.3)

** Execute ts:stop
searchd is not currently running.
** Invoke ts:clear (first_time)
** Invoke ts:sql:clear (first_time)
** Invoke environment
** Execute ts:sql:clear
** Invoke ts:rt:clear (first_time)
** Invoke environment
** Execute ts:rt:clear
** Execute ts:clear
** Invoke ts:configure (first_time)
** Invoke environment
** Execute ts:configure
Generating configuration to /home/petr/server/config/test.sphinx.conf
** Invoke ts:sql:index (first_time)
** Invoke environment
** Execute ts:sql:index
** Invoke ts:start (first_time)
** Invoke environment
** Execute ts:start
Sphinx 2.2.9-id64-release (rel22-r5006)
Copyright (c) 2001-2015, Andrew Aksyonoff
Copyright (c) 2008-2015, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/server/config/test.sphinx.conf'...
FATAL: no indexes found in '/home/petr/server/config/test.sphinx.conf'

The Sphinx start command failed:
  Command: searchd --pidfile --config "/home/petr/server/config/test.sphinx.conf"
  Status:  1
  Output:  See above

There may be more information about the failure in /home/petr/server/log/test.searchd.log.

sphinx.conf

indexer
{
}

searchd
{
  listen = 127.0.0.1:9306:mysql41
  log = /home/petr/server/log/test.searchd.log
  query_log = /home/petr/server/log/test.searchd.query.log
  pid_file = /home/petr/server/log/test.sphinx.pid
  workers = threads
  binlog_path = /home/petr/server/tmp/binlog/test
}

searchd.log

[Tue Jun  9 12:24:45.849 2020] [10848] caught SIGTERM, shutting down
[Tue Jun  9 12:24:45.967 2020] [10848] shutdown complete
[Tue Jun  9 12:24:45.973 2020] [10847] watchdog: main process 10848 exited cleanly (exit code 0), shutting down
pat commented 4 years ago

Hmm… so it seems Sphinx is installed correctly, and the relevant gems are there… but I'm not sure why the index definition isn't being found.

What I'd like to do, but I don't have time right now, is create a Rails app with the same version of Rails/Ruby and see if I can reproduce the problem. Certainly, if you'd like to give that a shot, that'd be great! Also, I've no idea if upgrading Rails to at least the latest 5.0.x release (5.0.7.2) would help, but I'd certainly recommend that anyway.

petropush commented 4 years ago

I'll try that, thanks.

petropush commented 4 years ago

Sorry for the delay with reply,. I've tried both ways: 1) New app with the same Rails/Ruby version 2) New app with Rails 6.0.3.2 and ruby 2.7.0 Same result :( I've also updated Thinking Sphinx to v5.0, it doesn't helped either.

Do you have any ideas where to dig next?

Thank you.

pat commented 4 years ago

Sorry for my own slow response.

It sounds like Sphinx is at fault here, not Thinking Sphinx. I wonder if it's worth reinstalling Sphinx (and ideally use v2.2.11, as it remains the latest stable release that supports PostgreSQL reliably - the 3.x releases are buggy, unfortunately).

Also, even with your current Sphinx installation, I wonder what the output is when you run the indexer directly?

indexer --config config/development.sphinx.conf --all

(Though your examples are in the test environment, so you may also want to try with test.sphinx.conf in case that's different.)

pat commented 3 years ago

Closing this issue as it's been dormant for a few months - but certainly, if the problem is still occurring, please do comment and we can re-open and continue to investigate.

petropush commented 3 years ago

Hello I've managed to get response from rake ts:rebuild command(please, see below) - as you said, there was a problem with Sphinx installation. However, index definitions still can't be found

searchd is not currently running.
Generating configuration to /home/petr/server/config/test.sphinx.conf
Sphinx 2.2.9-id64-release (rel22-r5006)
Copyright (c) 2001-2015, Andrew Aksyonoff
Copyright (c) 2008-2015, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/home/petr/server/config/test.sphinx.conf'...
FATAL: no indexes found in '/home/petr/server/config/test.sphinx.conf'

The Sphinx start command failed:
  Command: searchd --pidfile --config "/home/petr/server/config/test.sphinx.conf"
  Status:  1
  Output:  See above

I've tried creating a new app and changing Ruby - no success

pat commented 3 years ago

Are you able to put the test app into a public git repo, so I can try it on my own machine?