我已经成功地使用了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?');
Sphinx conf:
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
任何人都知道为什么会这样做?
提前致谢 -Phill
修改
阿。好的,进一步。我没有提到我一直在Mac OS上进行所有这些测试。看起来这可能是我的问题。我刚刚在linux上用64位编译而且效果很好..当我运行编译没有采用的Sphinx命令行命令时,还有一个线索:
我的Mac(已损坏)
Sphinx 0.9.9-release (r2117)
Linux框(正常工作)
Sphinx 0.9.9-id64-release (r2117)
所以我想新问题是在mac os上编译64位密钥的技巧是什么?
答案 0 :(得分:0)
您是否使用64位索引器重建索引?