Download & Extend

sphinx_default_server and sphinx_default_port almost never used

Project:Sphinx (Sphinx search integration)
Version:5.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:johannesdr
Status:needs review

Issue Summary

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.

Comments

#1

Status:active» needs review

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.

AttachmentSize
non-localhost-server.patch 4.07 KB

#2

Could you explain, what the patch does?

#3

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.

#4

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

~Nestor