J
J
Jamaludin Osmanov2018-06-02 23:50:54
PHP
Jamaludin Osmanov, 2018-06-02 23:50:54

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
}

Loaded into the table several values ​​for the test.
5b12a0ef0add2282970393.jpeg
I run the script
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);
}

And he issues
{
    "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"
        }
    }
}

I can't figure out what the problem is. Everything seems to be working. There is a contacts file. There were no errors while executing requests. searchindex and searchd started up fine.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Puma Thailand, 2018-06-03
@opium

Have you started the indexer?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question