为了提高索引的速度,利用缓存的方式,达到一定量的时候flush。 lucene2.2版本代码这样写:(部分代码) IndexWriter fsWriter = new IndexWriter(fsDir,analyzer, true); addDocument(fsWriter, s); //添加一条信息到Document if (fsWriter.ramSizeInBytes() > IParaConf.MAXMEMERY) {// 重点:判断内存使用量,大于指定的flush到硬盘。 System.out.println("flush..."); fsWriter.flush(); ...
tongjian
搜索本博客
最近加入圈子
最新评论