D
D
Drum Kit2015-04-21 11:27:07
Sphinx
Drum Kit, 2015-04-21 11:27:07

How to search in sphinx in Russian?

I decided to use Sphinx for the project, but such a problem does not work to search for words in Russian. in English there are no problems, but with Russian
, here is the line in which I make a request
$res = $cl->Query ("words", "content" );

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander N++, 2015-04-21
@sanchezzzhak

Config to the studio + table schema and query in SphinxQl
For now, my guess is that you have a different encoding
. I will give a config for every fireman that I slightly rewrite from project to project to suit the needs..

## Базовый конфиг для всех источников
source sitename_config
{
  type			= mysql
  sql_host		= localhost
  sql_user		= root
  sql_pass		= mysql
  sql_db			= new_site
  sql_port		= 3306

    	sql_query_pre = SET NAMES utf8
    sql_query_pre = SET CHARACTER SET utf8
}

# применили конфиг путем наследования
source sitename_audio :sitename_config
{
  sql_query = \
    SELECT a.* \
    FROM  audio a
# указываем какие поля мы хотим индексировать
    sql_attr_uint	 = user_id
    sql_field_string = id3_title
    sql_field_string = id3_artist
    sql_field_string = description
    sql_attr_json    = id3_json
}

index sitename_audio 
{
  source			  = sitename_audio 
  path			  = e:/Server/sphinx/data/sitename_audio
  docinfo			  = extern
  charset_table     = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F
  min_word_len      = 3
  html_strip        = 1       
  min_infix_len     = 3      
  index_exact_words = 1
  blend_chars = &,U+23

  #morphology		= stem_en
  #morphology		= stem_enru, soundex, metaphone

# морфология через словари словоформ...
  morphology      = lemmatize_ru_all
}

##################
#  Comon config
##################

indexer
{
  mem_limit		= 128M
}

searchd
{
  listen			= 9312
  listen			= 9306:mysql41
  log				= e:/Server/sphinx/log/searchd.log
  query_log		= e:/Server/sphinx/log/query.log
  read_timeout	= 5
  max_children	= 30
  pid_file		= e:/Server/sphinx/log/searchd.pid
  max_matches		= 1000
  seamless_rotate	= 1
  preopen_indexes	= 1
  unlink_old		= 1
  workers			= threads # for RT to work
  binlog_path		= e:/Server/sphinx/data
}

common
{
  lemmatizer_base = e:/Server/sphinx/dicts/
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question