Lucene indexing and searching at the same time(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!
推荐答案
misc
Lucene 包中的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 索引和搜索同时进行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Lucene 索引和搜索同时进行


- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01