Search code examples
ruby-on-railsthinking-sphinx

Is it possible to configure (Thinking) Sphinx on a separate database from the Rails app?


Is it possible to have my app use (in development mode) a SQLite3 adapter, while Sphinx uses Postgres?

I tried to do it by adding the file config/thinking_sphinx.yml below, but I get an error message telling me that SQLite3 is not supported. My config/database.yml has SQLite3 in development, of course.

default: &default
  encoding: utf8
  host: localhost
  adapter: postgresql
  port: 5432
  pool: 5
  timeout: 5000

development:
  <<: *default
  database: ts_development

test:
  <<: *default
  database: ts_test

production:
  <<: *default
  database: ts_production

Solution

  • If you want to use Sphinx, then you need to use either PostgreSQL or MySQL for that environment. So, technically yes, you can use SQLite in development, that will mean you can't use Sphinx or Thinking Sphinx in development, which is I think is a very bad move: I would recommend using the same database in all environments generally (whether or not Sphinx is involved), and especially so in this case, otherwise you won't be able to do anything search-related in your development environment.