N
N
nazmutdinovrafael2019-06-24 14:20:10
Sphinx
nazmutdinovrafael, 2019-06-24 14:20:10

Why is Sphinx not searching in Russian?

Sphinx searches in Latin, but not in Cyrillic. Database encoding - UTF-8 Unicode (utf8), comparison - utf8_unicode_ci.
Latin search example:
Query :
SELECT * FROM `category` WHERE MATCH('mol') LIMIT 10
Sphinx log :
[Mon Jun 24 18:37:43.275 2019] 0.000 sec 0.000 sec [ext2/0/ext 2 (0 ,10)] [category] mol
Result :
{"categories":[{"id":9,"name":"Dairy","keywords":"milk"},{"id":30,"name ":"Coffee ground","keywords":""}]}
Cyrillic search example:
Query :
SELECT * FROM `category` WHERE MATCH('may') LIMIT 10
In the Sphinx log :
Result :
{"categories":[]}
Sphinx config:

source category_src
{
  type			= mysql

  sql_host		= 127.0.0.1
  sql_user		= root
  sql_pass		= root
  sql_db		 = myproject
  sql_port		= 3306

    sql_query_pre = SET NAMES utf8

  sql_query		= \
    SELECT `category`.* \
    FROM `category` \
    WHERE `category`.`is_deleted` = 0

  sql_attr_string = name
  sql_attr_string = keywords
}

index category
{
  source			= category_src
  path			= /usr/local/var/data/category

    docinfo = extern
    dict = keywords
    charset_type   = utf-8
    charset_table  = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F, U+401->U+451, U+451
    blend_chars    = &, ., +, U+23
    morphology = stem_enru, soundex, metaphone
    index_exact_words = 1
  expand_keywords = 1
  min_word_len = 1
  min_prefix_len = 1
  html_strip = 1
  mlock = 0
}


indexer
{
  mem_limit = 128M
}


searchd
{
  listen = 9312
  listen = 9306:mysql41
  log	= /usr/local/var/log/searchd.log
  query_log = /usr/local/var/log/query.log
  read_timeout = 5
  max_children = 30
  pid_file = /usr/local/var/log/searchd.pid
  seamless_rotate	= 1
  preopen_indexes = 1
  unlink_old = 1
  workers	= none
  binlog_path	= /usr/local/var/data
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Puma Thailand, 2019-06-27
@nazmutdinovrafael

Judging by the description, I should look for it, if something has changed, then try reindexing and reloading the sphinx itself

I
Ivan, 2019-07-16
@sait4seo

Check/set connection character set
via terminal like so mysql -u root -P 9306 --default-character-set=utf8

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question