拉丁语和俄语转译仍然正常搜索(!)
$ search sumka
using config file '/etc/sphinx/sphinx.conf'...
index 'test1': query 'sumka ': returned 636 matches of 636 total in 0.000 sec
displaying matches:
1. document=154143, weight=1660, name=Сумка Sony LCS-MS10 Gray Alpha Текстильная сумка для фотокамеры Alpha Серый цвет, casual style (сумка почтальона) [LCSMS10H.AE], description_short=Сумка Sony LCS-MS10 Gray Alpha Текстильная сумка для фотокамеры Alpha Серый цвет, casual style (сумка почтальона) [LCSMS10H.AE]
...
$ search сумка
using config file '/etc/sphinx/sphinx.conf'...
index 'test1': query 'сумка ': returned 0 matches of 0 total in 0.000 sec
words:
1. 'сумка': 0 documents, 0 hits
听起来像这里的字符集问题,但我在 mysql 和查询中有 utf8
mysql> show variables like "character%";
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
mysql> show variables like "collation%";
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_unicode_ci |
+----------------------+-----------------+
$ file words
words: UTF-8 Unicode text
$ cat words | search --stdin
using config file '/etc/sphinx/sphinx.conf'...
index 'test1': query 'сумка
': returned 0 matches of 0 total in 0.000 sec
words:
1. 'сумка': 0 documents, 0 hits
这对于 php 客户端和 sphinx mysql 之类的客户端也是如此。
完整的狮身人面像配置在这里,但重要部分的引用:
source src1
{
...
sql_query_pre = SET NAMES utf8
sql_query_pre = SET CHARACTER SET utf8
...
}
index test1
{
...
charset_type = utf-8
...
}
我只发现了一个类似的问题,但 db 中有 latin1 字符集。
程序版本是:
mysql Ver 14.14 Distrib 5.5.20, for Linux (x86_64) using readline 5.1
Sphinx 2.0.6-id64-release (r3473)
centos 5.8
更新
将 charset_table 添加到配置来自http://sphinxsearch.com/wiki/doku.php?id=charset_tables#cyrillic的表格,但仍然没有好处。
我还在本地 gentoo 上安装了 Sphinx 2.0.5-release (r3308),它可以开箱即用地处理西里尔字母查询。