在 Lucene 中更快的搜索 - 有没有办法将整个索引保存在 RAM 中? [英] Faster search in Lucene - Is there a way to keep the whole index in RAM?

查看:10
本文介绍了在 Lucene 中更快的搜索 - 有没有办法将整个索引保存在 RAM 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将索引保存在 RAM 中而不是保存在硬盘上?

Is there a way of keeping the index in RAM instead of keeping it on the hard disk?

我们希望加快搜索速度.

We want to make searching faster.

推荐答案

有没有办法将索引保存在 RAM 中而不是保存在硬盘上?

Is there a way of keeping the index in RAM instead of keeping it on the hard disk?

使用 RAMDirectory

Using the RAMDirectory class

使用示例这里

SampleUsage here

同样来自 Lucene 常见问题

Also from the Lucene FAQs

ImproveSearchingSpeed

一般来说,为了更快的索引性能,最好根据 RAM 使用情况而不是文档计数来刷新,并尽可能使用大的 RAM 缓冲区.

还要检查这个问题:

RE: RamDirectory,正如 API 所说,RamDirectory 是内存驻留的目录实现.,它只保留那些索引目录指定的 RAM RAMDirecory

RE: RamDirectory, As the API says RamDirectory is A memory-resident Directory implementation., it keeps only those index in RAM as specified by directory RAMDirecory

RE:缓存 据我所知,Lucene 通过过滤器缓存搜索结果,请查看@CachingWrapperFilterQueryWrapperFilter

RE:Caching In my knowledge, Lucene caches search results by means of filters pls look @ CachingWrapperFilter and QueryWrapperFilter

这篇关于在 Lucene 中更快的搜索 - 有没有办法将整个索引保存在 RAM 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆