Thinking Sphinx can't find Sphinx.

Hello everybody,   I've been trying to set up Sphinx and Thinking Sphinx for a RoR project of mine. Firstly, I'm running Ubuntu Server 9.10 w/ Rails 3 and have successfully installed Sphinx. It can connect to MySQL and index my model:

root@edison:/home/jmiller# /usr/local/sphinx/bin/indexer --all Sphinx 0.9.9-release (r2117) Copyright (c) 2001-2009, Andrew Aksyonoff

using config file '/usr/local/sphinx/etc/sphinx.conf'... indexing index 'test_specs'... collected 2 docs, 0.0 MB sorted 0.0 Mhits, 100.0% done total 2 docs, 394 bytes total 0.005 sec, 76267 bytes/sec, 387.14 docs/sec total 2 reads, 0.000 sec, 0.3 kb/call avg, 0.0 msec/call avg total 7 writes, 0.000 sec, 0.4 kb/call avg, 0.0 msec/call avg

Ok. Now I've been trying to get the Thinking Sphinx gem (with instructions for Rails 3) to work, but no luck. I used these instructions: http://freelancing-god.github.com/ts/en/rails3.html . I also can confirm that the gem is installed (thinking-sphinx (2.0.2)). However, this is supposed to generate some sort of sphinx.yml file, but no such file exists. When I try to use the Thinking Sphinx rake tasks or start my server, I get this message:

Sphinx cannot be found on your system. You may need to configure the following settings in your config/sphinx.yml file:   * bin_path   * searchd_binary_name   * indexer_binary_name

...but that config/sphinx.yml doesn't exist... I do have a file called development.sphinx.conf, but thats it. Can anyone point me in the right direction here? I've been trying to get this going for a few days now...

Thanks in advance! Any and all help is appreciated!

- Jeff

Hmmm, well it looks like it's actually Sphinx that's the problem, oops:

jmiller@edison:~/dev/PlurPlay$ service searchd start Starting searchd [sudo] password for jmiller: Sphinx 0.9.9-release (r2117) Copyright (c) 2001-2009, Andrew Aksyonoff

using config file '/usr/local/sphinx/etc/sphinx.conf'... listening on all interfaces, port=9312 bind() failed on 0.0.0.0, retrying... bind() failed on 0.0.0.0, retrying... bind() failed on 0.0.0.0, retrying...

Blast! I guess I gotta change something in sphinx.conf

Ah, ok sphinx starts. It was set to 0.0.0.0 by default, but is now set to 127.0.0.1:9312. However, my rails installation still can't see Sphinx...

Hi Jeff

I'm guessing that searchd and indexer aren't in your path by default... not sure where Ubuntu puts them, though given your output thus far, maybe /usr/local/sphinx/bin?

Thinking Sphinx doesn't create config/sphinx.yml by default - but you'll probably need to create it yourself, then add a setting with the bin_path pointing to the folder where searchd and indexer are located:

  development:     bin_path: "/usr/local/sphinx/bin"

If you're running the production environment instead, then you'll want to change/add the setting for that as well - the format of sphinx.yml is the same as database.yml - settings per environment.

One last thing - you don't want to use the default sphinx.conf - Thinking Sphinx doesn't write to that file, it creates a new one, and tells Sphinx to reference the new file as well. So make sure you've stopped the Sphinx service that references that old file.

Cheers

Pat my friend, you are a life saver. I created the sphinx.yml and added the bin path. It now is able to see Sphinx! I've still got some troubleshooting to do, but at least it works now!

Thanks again,   - Jeff

pat wrote in post #981469:

Great to hear - if you get stuck again, feel free to ask on the Thinking Sphinx google group - I only caught this post because it appeared in Twitter via a saved 'thinking sphinx' search :slight_smile:

http://groups.google.com/group/thinking-sphinx

Cheers

Thanks for the heads up. Will do!

pat wrote in post #981495:

Add sphinx.yml file in cofig folder with added following line. it will surely work fine

development:   version: '2.0.11'

Add sphinx.yml file in config folder with added following line. it will surely work fine

development:   version: '2.0.11'