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

查看:13
本文介绍了在 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 此处

SampleUsage here

同样来自 Lucene FAQs

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:Caching 据我所知,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天全站免登陆