如何在 Mac OS 上获取 64 位 ID 以与 Sphinx 搜索服务器 0.9.9 配合使用?

发布于 2024-10-16 20:22:41 字数 2320 浏览 4 评论 0原文

我已经成功使用 Sphinx 一段时间了,但是遇到了一个让我困惑的问题...我使用 mysql 查询支持 Sphinx,最近以一种具有我所在表的 id 的方式迁移了我的主键策略索引变得大于 32 位(在 MYSQL 中它们是 bigint unsigned)。 Sphinx 获得了索引命中,但返回了无意义的 id(大概是查询返回的 id 的 32 位或其他内容)..

我调查了它,意识到我没有将 --enable-id64 标志传递给 ./configure 。没问题,用该标志完全重建了 sphinx(顺便说一下,我正在运行 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

有人知道为什么会出现这种情况吗?

提前致谢 -菲尔

编辑

啊。好吧,更进一步了。我没有提到我一直在 Mac 操作系统上进行所有这些测试。看起来这可能是我的问题。我刚刚在 Linux 上以 64 位编译,它运行得很好。当我运行 Sphinx 命令行命令时,还有一个线索,编译没有采用:

我的 Mac(损坏)

Sphinx 0.9.9-release (r2117)

Linux所以

Sphinx 0.9.9-id64-release (r2117)

我想新的问题是在 mac os 上编译 64 位密钥的技巧是什么?

I've been using Sphinx successfully for a while, but just ran into an issue that's got me confused... I back Sphinx with mysql queries and recently migrated my primary key strategy in a way that had the ids of the tables I'm indexing grow larger than 32 bits (in MYSQL they're bigint unsigned). Sphinx was getting index hits, but returning me nonsense ids (presumably 32 bits of the id returned by the queries or something)..

I looked into it, and realized I hadn't passed the --enable-id64 flag to ./configure. No problem, completely rebuilt sphinx with that flag (I'm running 0.9.9 by the way). No change though! I'm still experiencing the exact same issue. My test scenario is pretty simple:

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
}

Searching:

→ 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

Anyone have an idea about why this is broken?

Thanks in advance
-Phill

EDIT

Ah. Okay, got further. I didn't mention that I've been doing all of this testing on Mac OS. It looks like that may be my problem. I just compiled in 64 bit on linux and it works great.. There's also a clue when I run the Sphinx command line commands that the compile didn't take:

My Mac (broken)

Sphinx 0.9.9-release (r2117)

Linux box (working)

Sphinx 0.9.9-id64-release (r2117)

So I guess the new question is what's the trick to compiling for 64 bit keys on mac os?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

昔日梦未散 2024-10-23 20:22:41

您是否使用 64 位索引器重建了索引?

Did you rebuild the index with 64 bits indexer?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文