问题描述
有没有一种方法可以将索引保留在RAM中而不是将其保留在硬盘上?
Is there a way of keeping the index in RAM instead of keeping it on the hard disk?
我们想使搜索更快.
推荐答案
是否可以将索引保留在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常见问题解答
Also from the Lucene FAQs
ImproveSearchingSpeed
通常,为了获得更快的索引性能,最好按RAM使用量而不是文档计数进行刷新,并尽可能使用较大的RAM缓冲区.
Also check this question:
RE:RamDirectory ,正如API所述,RamDirectory是驻留内存的目录实现.,它仅将那些索引保留在由目录 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通过过滤器缓存搜索结果,请查找@ CachingWrapperFilter 和 QueryWrapperFilter
RE:Caching In my knowledge, Lucene caches search results by means of filters pls look @ CachingWrapperFilter and QueryWrapperFilter
这篇关于在Lucene中进行更快的搜索-有没有办法将整个索引保留在RAM中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!