gpt4 book ai didi

c# - 写入后是否必须优化lucene索引?

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:12:26 25 4
gpt4 key购买 nike

目前我正在写入完成后调用索引编写器的优化方法。由于我的数据集很大,需要很长时间(并且需要更多空间(2*实际大小))来优化索引。我非常担心这一点,因为索引中经常包含很多文档。

所以

  1. 可以关闭优化吗​​?
  2. 对性能有何影响,例如未优化时查询速度有多慢?

干杯

最佳答案

Lucene FAQ说:

What is index optimization and when should I use it?

The IndexWriter class supports an optimize() method that compacts the index database and speeds up queries. You may want to use this method after performing a complete indexing of your document set or after incremental updates of the index. If your incremental update adds documents frequently, you want to perform the optimization only once in a while to avoid the extra overhead of the optimization.

If I decide not to optimize the index, when will the deleted documents actually get deleted?

Documents that are deleted are marked as deleted. However, the space they consume in the index does not get reclaimed until the index is optimized. That space will also eventually be reclaimed as more documents are added to the index, even if the index does not get optimized.

关于c# - 写入后是否必须优化lucene索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3912253/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com