Search code examples
ruby-on-railssphinxthinking-sphinx

Thinking Sphinx: same app installed multiple times


I have a RoR app that is installed multiple times in the same machine. The app is the same, it's just installed with different names (i.e: app1, app2, ...).

The app uses ThinkingSphinx for searching. It has one index for the model Element. Each installation of the app will have it's own database with its own Elements.

So my question is:

  • Should I have multiple Sphinx instances running by changing the port, one per app? (I tried this option with 2 installations and it works well, but I think there are some issues regarding server load)

  • Should I have only one Sphinx instance? In that case, where should I configure Sphinx? How can I configure it to access different databases? How can I tell it to differentiate between instances from different apps?

  • Should I go with another solution?

Thank you in advance


Solution

  • Separate Sphinx instances (running on different ports) is definitely the way to go.

    Sphinx requires every document to have a unique id, even between different index files, so managing that with a standard Thinking Sphinx-generated configuration is painful with multiple applications - you'd need to manage the single configuration file yourself, really, plus adapt Thinking Sphinx to only search across the relevant data set for each app. It could be interesting on some level, but my gut feel is that it's really not worth the effort or time. Use different ports, different daemons, much easier.