Multiple Indexes search in Lucene.Net

£可爱£侵袭症+ 提交于 2020-01-03 09:11:33

问题


I have multiple lucene.net indexes that I would need to search on for a query string. So will I need to open a new IndexSearcher on all these indexes or can I achieve this with a single IndexSearcher?

Thanks


回答1:


It can be accomplished using the MultiSearcher.

It implements the Searchable interface over multiple subsearchers. If you only need methods from the Searchable interface it will be just like a regular IndexSearcher to you.

If you need to access the underlying searchers that found a document, you can use the subSearcher(int) and subDoc(int) methods.

http://lucene.apache.org/java/2_9_4/api/core/org/apache/lucene/search/MultiSearcher.html



来源:https://stackoverflow.com/questions/7677845/multiple-indexes-search-in-lucene-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!