sphinx_default_server and sphinx_default_port are (almost) never used when a sphinx client is created. So the client will use localhost:3312 as searchd server, which is a problem when searchd runs on a different server or port.
SetServer (from the sphinx api) should be used after creating a sphinx client (new SphinxClient();).
I am working on a patch.

CommentFileSizeAuthor
#1 non-localhost-server.patch4.07 KBjohannesdr
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

johannesdr’s picture

Status: Active » Needs review
FileSize
4.07 KB

I created a patch that will make sphinx use the default_server and default_port set in admin/settings/sphinx instead of the default localhost and 3312.

johsw’s picture

Could you explain, what the patch does?

johannesdr’s picture

Every time the sphinx module checks to see if the sphinx deamon is online it uses
$connect = $client->_Connect();
This uses the connect function from the sphinx php api. And when no server is specified it uses localhost and the standard port.
Even if you have filled in a server and port in the sphinx administration page it will still use localhost.

We had our sphinx deamon on a different server so we allways got the message: Searchd not running.

What we did is replace

$client = new SphinxClient();
$connect = $client->_Connect();

with

$client = new SphinxClient();
$host = variable_get('sphinx_default_server', 'localhost');
$port = variable_get('sphinx_default_port', '3312');
$client->SetServer($host, $port);
$connect = $client->_Connect();

So now it will first get the variables entered in the administration page. If these are not set it will use the default localhost and 3312 port.

nestor.mata’s picture

This also happens on version 6.x.
This is fixed in version 6.x-1.2.

~Nestor