Lucene中的细分是什么? [英] What are segments in Lucene?

查看:95
本文介绍了Lucene中的细分是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Lucene中的细分是什么?

细分的好处是什么?

推荐答案

Lucene索引被分成称为段的较小块.每个段都是其自己的索引. Lucene依次搜索所有它们.

The Lucene index is split into smaller chunks called segments. Each segment is its own index. Lucene searches all of them in sequence.

打开新编写器时,提交者提交或关闭时都会创建一个新的段.

A new segment is created when a new writer is opened and when a writer commits or is closed.

使用此系统的优点是,创建段后,您无需修改​​段文件.当您在索引中添加新文档时,它们将被添加到下一个段.以前的段永远不会被修改.

The advantages of using this system are that you never have to modify the files of a segment once it is created. When you are adding new documents in your index, they are added to the next segment. Previous segments are never modified.

通过简单地在文件中指示删除段的哪个文档来完成删除文档,但是实际上,该文档始终停留在该段中. Lucene中的文档并没有真正更新.发生的情况是该文档的先前版本在其原始段中被标记为已删除,而新版本的文档被添加到当前段中.通过在发生更改时不断修改索引的内容,可以最大程度地减少破坏索引的机会.它还使跨不同机器的索引的备份和同步变得容易.

Deleting a document is done by simply indicating in a file which document of a segment is deleted, but physically, the document always stays in the segment. Documents in Lucene aren't really updated. What happens is that the previous version of the document is marked as deleted in its original segment and the new version of the document is added to the current segment. This minimizes the chances of corrupting an index by constantly having to modify its content when there are changes. It also allows for easy backup and synchronization of the index across different machines.

但是,Lucene可能会决定合并某些段.也可以通过优化触发此操作.

However, at some point, Lucene may decide to merge some segments. This operation can also be triggered with an optimize.

这篇关于Lucene中的细分是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆