Answer the question
In order to leave comments, you need to log in
Why doesn't sphinx return matches?
Set up the configuration
source contacts
{
type = mysql
sql_host = localhost
sql_user = export_user
sql_pass = Y1q0P2s8
sql_db = sales_db
sql_port = 3306
sql_query_pre = SET NAMES utf8
sql_query_pre = SET CHARACTER SET utf8
sql_query = SELECT * FROM contacts WHERE CHAR_LENGTH(name)>4
sql_attr_string = name
}
index contacts
{
source = contacts
path = /var/lib/sphinxsearch/data/contacts
docinfo = extern
mlock = 0
morphology = soundex, metaphone
charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F
}
searchd
{
listen = 9312
log = /var/lib/sphinxsearch/log.log
query_log = /var/lib/sphinxsearch/query.log
read_timeout = 5
max_children = 30
pid_file = /var/run/sphinxsearch/searchd.pid
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = /var/lib/sphinxsearch/data
}
require_once "sphinxapi.php";
$name = "Виктор Рядых";
$sphinx = new SphinxClient();
$sphinx->SetServer('localhost', 9312);
$sphinx->SetMatchMode(SPH_MATCH_ANY);
$sphinx->SetSortMode(SPH_SORT_RELEVANCE);
$result = $sphinx->query($name, "*");
if($result === false){
var_dump($sphinx->GetLastError());
}else{
var_dump($result);
}
{
"error": "",
"warning": "",
"status": 0,
"fields": [
"updated_at",
"created_at",
"created_by",
"responsible_user_id",
"company",
"tags"
],
"attrs": {
"name": 7
},
"total": "0",
"total_found": "0",
"time": "0.000",
"words": {
"виктор": {
"docs": "0",
"hits": "0"
},
"рядых": {
"docs": "0",
"hits": "0"
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question