本文介绍了Lucene同时索引和搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用Lucene搜索索引。索引经常更改。所以我需要做一些事情来同时搜索和索引。它是Tomcat上的Web应用程序。我想使用RAMDeirectory来提高搜索速度。我不知道怎么做!
I want to search with Lucene on an index. The index is changed frequently. So I need to do something to search and index at the same time. It's a web application on Tomcat. And I want to use RAMDeirectory to increase the searching speed. I don't know how to do it!
推荐答案
Lucene包提供了同时搜索和索引的功能。 misc中的NRTManager
NRTManager
in the misc
Lucene package provides the ability to search and index at the same time.
TrackingIndexWriter writer; // your writer
SearcherFactory factory = new SearcherFactory();
NRTManager mgr = new NRTManager(writer, factory);
检查NRTManager方法以获取更多信息。
Check NRTManager methods for more info.
这篇关于Lucene同时索引和搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!