创建lucene indexWriter的开销?
<代码>
IndexWriter myWriter = new IndexWriter(pathOnDisk);
int segCount = myWriter.GetSegmentCount();
if (segCount > 1)
myWriter.Optimize();
myWriter.Close()
我想为 50 个不同的索引目录运行上面的代码,所以我想知道打开索引编写器是否有开销?
IndexWriter myWriter = new IndexWriter(pathOnDisk); int segCount = myWriter.GetSegmentCount(); if (segCount > 1) myWriter.Optimize(); myWriter.Close()
I want to run the above code for 50 different index directory, so i want to know if opening an indexwriter has overhead ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它有一些开销,包括创建一个锁文件(参见第 133 行)、读取段信息以及一堆其他可能很昂贵也可能不昂贵的东西。
查看 java 源代码,从第 816 行开始。它不是一个小构造函数,但您必须判断它的重要性。
It has some overhead, including creating a lock file (see line 133), reading the segment infos, and a bunch of other stuff that may or may not be expensive.
Check out the java source, starting at line 816. It's not a small constructor, but you'll have to be the judge of how significant it is.