I've recently installed sphinx for my MySQL database, and have configured the config file & I am getting correct results when running search.exe, but when I use the PHP API (along with its wrapper for CodeIgniter ). I am still 0 zero results. Now I am pretty sure that my php code is correct since it is basic (get the keys, run a mysql query, and the return the results). What reasons could cause such a problem? here is the searchd portion of the sphinx config file, do I need to modify anything? :
searchd
{
# listen = 9312
listen = 9306:mysql41
port = 3312
log = C:/sphinx/log/searchd.log
query_log = C:/sphinx/log/query.log
read_timeout = 5
max_children = 30
pid_file = C:/sphinx/log/searchd.pid
max_matches = 1000
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = C:/sphinx/data
}
and here is my search.php sphinx query:
$search_string=$this->input->post('q');
$this->load->library('Sphinxclient');
$this->sphinxclient->setMatchMode(SPH_MATCH_ANY);
$this->sphinxclient->SetArrayResult(TRUE);
$users_ids=$this->sphinxclient->Query('users_info',$search_string);
Now I am not sure how the API or sphinx finds the mysql directory and connects to it, but I am reading the sphinx documentation, and in the basic api functions section, it says that the function SetServer has default values of "localhost", and port "9312". Could this be the problem since in my config file I have a different port and I have commented out the 9312 listening?
Here is my definition of users_info source and index (although I doubt this is the problem since search.exe is able to get results).
source users_info
{
type = mysql
sql_host = localhost
sql_user = admin
sql_pass = admin
sql_db = users
sql_sock = /var/run/mysqld/mysqld.sock
sql_port = 3306
sql_query = \
SELECT id, fullname,username FROM users_info;
sql_query_info = SELECT * FROM users WHERE id=$id
}
and index:
index users_info
{
source = users_info
path = C:/sphinx/data/users_info
docinfo = extern
charset_type = utf-8
}
Also, one more thing, in the API, I flipped the arguments in the Query function in the API, I have fixed that but that didn't fix the issue.
Any Ideas?