如何在Lucene中正确使用multireader API?
我有几个索引,但想知道哪种使用方式是正确的。
IndexReader r1= IndexReader.open(...)
IndexReader r2= IndexReader.open(...)
MultiReader mr= new MultiReader(r1,r2)
1)
IndexSearcher s = new IndexSearcher(mr);
2)
IndexSearcher s = new IndexSearcher(mr,new IndexReader[]{r1,r2}....
哪一项是正确的?
I have several indexes, but wanted to know which way of using is correct.
IndexReader r1= IndexReader.open(...)
IndexReader r2= IndexReader.open(...)
MultiReader mr= new MultiReader(r1,r2)
1)
IndexSearcher s = new IndexSearcher(mr);
2)
IndexSearcher s = new IndexSearcher(mr,new IndexReader[]{r1,r2}....
Which one is correct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该坚持遵循 Lucene API 文档,
在大多数版本的 Lucene 库中,接受子阅读器(IndexSearchders 的附加数组)的 IndexSearcher 的构造函数用法都标有警告,不鼓励其使用,
标有 '警告:此 API 是实验性的,并且可能在下一版本中以不兼容的方式进行更改。'。我猜引入这些额外的构造函数选项的原因是为了促进内部 Lucene 子类化,请参阅 上的评论LUCENE-1925
3.5.0
Going by Lucene API Doc you should stick to,
In most versions of Lucene Library, constructor usages of IndexSearcher that accepts subreaders (additional array of IndexSearchders) are marked with warning discouraging their use,
is marked with 'WARNING: This API is experimental and might change in incompatible ways in the next release.'. I guess the reason those additional constructors options introduced was to facilitate internal Lucene Subclassing, please refer to comments on LUCENE-1925
3.5.0