加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Sphinx delta索引 – 仍然需要重建主索引?

发布时间:2020-12-17 03:57:40 所属栏目:百科 来源:网络整理
导读:我一直在阅读Sphinx搜索引擎和Thinking Sphinx宝石.在TS docs中,它说…… Sphinx has one major limitation when compared to a lot of other search services: you cannot update the fields [of] a single document in an index,but have to re-process al
我一直在阅读Sphinx搜索引擎和Thinking Sphinx宝石.在TS docs中,它说……

Sphinx has one major limitation when compared to a lot of other search services: you cannot update the fields [of] a single document in an index,but have to re-process all the data for that index.

如果我理解正确,这意味着当用户添加或编辑某些内容时,更改不会反映在索引中.因此,如果他们添加记录,则在重建整个索引之前不会出现搜索.或者如果他们删除记录,它将出现在搜索中,然后导致某种错误或令人沮丧的行为.

此外,在重建索引时,Sphinx将被关闭.因此,您的应用的搜索功能会定期下线(每小时一次,每隔几个小时一次),任何尝试进行搜索的人都会收到错误或“稍后尝试”消息.

好的,显然在现实世界的应用程序中都不能接受.所以你几乎必须使用delta索引.

但显然你仍然需要经常关闭你的搜索引擎并做一个完整的索引…

Turning on delta indexing does not remove the need for regularly running a full re-index,as otherwise the delta index itself will grow to become just as large as the core indexes,and this removes the advantage of keeping it separate. It also slows down your requests to your server that make changes to the model records.

我真的不明白文档在这里说的是什么.也许有人可以帮助我.我认为delta索引的重点在于你不需要定期重建索引.只要数据发生变化,它就会立即更新.

因为每小时或每一件事都重建索引会完全混乱,对吧?

解决方法

If I understand correctly,that means
when a user adds or edits something,
the change is not reflected in the
index. So if they add a record it
won’t come up in searches until the
entire index is rebuilt. Or if they
delete a record,it will come up in
searches,and then cause some kind of
error or frustrating behavior.
Moreover,while rebuilding the index Sphinx is shut down. …

您无需重建索引 – 只需重新索引它们即可.这意味着 – 没有必要停止守护进程.只有在更改索引的结构后才需要重建 – 这不是这里的情况.

而对于第二部分 – 再次,你不重建索引,ergo停止deamon是没有必要的.当使用delta索引时,实际上有两个用于搜索的索引 – 主索引(应该重新索引一次)和delta索引(在记录上的每个相关操作之后刷新).如果我理解正确,当重新索引主索引(例如通过cron任务)时,delta索引只是简单地合并到主索引中,因此它不会占用那么多地方并保持快速.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读