我已经成功使用 Sphinx 有一段时间了,但遇到了一个让我感到困惑的问题......我用 mysql 查询支持 Sphinx,最近以一种具有我所在表的 id 的方式迁移了我的主键策略索引增长大于 32 位(在 MYSQL 中它们是 bigint 无符号的)。Sphinx 正在获得索引命中,但返回给我无意义的 id(大概是查询返回的 32 位 id 或其他东西)..
我查看了它,并意识到我没有将 --enable-id64 标志传递给 ./configure。没问题,使用该标志完全重建狮身人面像(顺便说一下,我正在运行 0.9.9)。虽然没有变化!我仍然遇到完全相同的问题。我的测试场景非常简单:
MySQL:
create table test_sphinx(id bigint unsigned primary key, text varchar(200));
insert into test_sphinx values (10102374447, 'Girls Love Justin Beiber');
insert into test_sphinx values (500, 'But Small Ids are working?');
狮身人面像配置:
source new_proof
{
type = mysql
sql_host = 127.0.0.1
sql_user = root
sql_pass = password
sql_db = testdb
sql_port =
sql_query_pre =
sql_query_post =
sql_query = SELECT id, text FROM test_sphinx
sql_query_info = SELECT * FROM `test_sphinx` WHERE `id` = $id
sql_attr_bigint = id
}
index new_proof
{
source = new_proof
path = /usr/local/sphinx/var/data/new_proof
docinfo = extern
morphology = none
stopwords =
min_word_len = 1
charset_type = utf-8
enable_star = 1
min_prefix_len = 0
min_infix_len = 2
}
搜索:
→ search -i new_proof beiber
Sphinx 0.9.9-release (r2117)
...
index 'new_proof': query 'beiber ': returned 1 matches of 1 total in 0.000 sec
displaying matches:
1. document=1512439855, weight=1
(document not found in db)
words:
1. 'beiber': 1 documents, 1 hits
→ search -i new_proof small
Sphinx 0.9.9-release (r2117)
...
index 'new_proof': query 'small ': returned 1 matches of 1 total in 0.000 sec
displaying matches:
1. document=500, weight=1
id=500
text=But Small Ids are working?
words:
1. 'small': 1 documents, 1 hits
任何人都知道为什么会被破坏?
在此先感谢-菲尔
编辑
啊。好吧,更进一步。我没有提到我一直在 Mac OS 上进行所有这些测试。看起来这可能是我的问题。我刚刚在 linux 上编译为 64 位,效果很好。当我运行编译没有使用的 Sphinx 命令行命令时,还有一个线索:
我的 Mac(坏了)
Sphinx 0.9.9-release (r2117)
Linux盒子(工作)
Sphinx 0.9.9-id64-release (r2117)
所以我想新问题是在 mac os 上编译 64 位密钥的技巧是什么?