Sphinx:indexer --merge 到底是做什么的?
Sphinx 手册说索引合并应该保留旧关键字和新关键字:
但请注意,在这种情况下,“旧”关键字不会被自动删除。例如,如果 DSTINDEX 中存在与文档 123 关联的关键字“old”,并且 SRCINDEX 中存在与文档 123 关联的关键字“new”,则合并后这两个关键字都会找到文档 123。
我无法重现这个。
- 我们有一个 id 为 1 的文档,索引
main
中的文本为“one” - 数据库表中的文本从“one”更改为“two”
indexer --rotate delta
indexer --rotate --merge main delta
- 等待
searchd
重新加载索引 - 现在我们可以通过
SELECT id FROM main WHERE match('two')< 找到文档 1 /代码>,但是
match('one')
未找到任何内容。
两个索引的源本质上定义为:
sql_query = SELECT id, text FROM tbl
我还尝试通过 sql_joined_field 指定关键字,并且合并也不会保留旧关键字。
这是否意味着手册有错误?是否可以安全地假设,如果 SRCINDEX 具有 ID 的信息(属性和文本关键字),合并过程将丢弃 DSTINDEX 具有该 ID 的所有内容并将其替换为新信息?
Sphinx manual says that index merging should keep old keywords along with new ones:
Note, however, that the "old" keywords will not be automatically removed in such cases. For example, if there's a keyword "old" associated with document 123 in DSTINDEX, and a keyword "new" associated with it in SRCINDEX, document 123 will be found by both keywords after the merge.
I cannot reproduce this.
- We have a document with id 1 and text 'one' in index
main
- Text in the DB table changes from 'one' to 'two'
indexer --rotate delta
indexer --rotate --merge main delta
- Wait for
searchd
to reload the index - Now we can find document 1 by
SELECT id FROM main WHERE match('two')
, butmatch('one')
does not find anything.
Sources for both indexes are defined essentially as:
sql_query = SELECT id, text FROM tbl
I have also tried to specify keywords via sql_joined_field
and merge does not keep old keywords from it too.
Does this mean the manual is wrong? Is it safe to assume that if SRCINDEX has info for an ID (attributes and text keywords), merge process will discard everything DSTINDEX had for that ID and replace it with new info?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我向安德烈·阿克森诺夫(狮身人面像的创造者)询问了这个问题。他说,现在如果索引 docinfo 是外部的,他们会在合并时清除重复的 id。
所以是的,这是文档中的一个错误。
I asked Andrey Aksenoff (creator of Sphinx) about this. He said that now they clean duplicate id while merging if index docinfo is extern.
So yes, it is a bug in documentation.
如果 Sphinx 在从搜索结果中消除重复 ID 时发现它们,那么您 Sphinx 仅返回唯一 ID。
这就是您在搜索结果中没有看到它们的原因。
If Sphinx found duplicate IDs when they are eliminated from search results, so you Sphinx return only unique IDs.
What's why you didn't see them in search results.