lucene3.0中两个索引文件的联合查询
由于lucene生成索引文件比较耗时,索引我们可以把经常变动的和不变化的防到两个索引文件中,查询时使用联合查询,可以在两个索引中同时查找.
IndexSearcher[] searchers = new IndexSearcher[2];
searchers[0] = new IndexSearcher(m_indexpath);
searchers[1] = new IndexSearcher(m_outindexpath);
MultiSearcher multiSearcher = new MultiSearcher(searchers);
TopScoreDocCollector collector = TopScoreDocCollector.create(10, false);
multiSearcher.search(q, collector);
ScoreDoc[] hits = collector.topDocs().scoreDocs;
欢迎转载,请注明出处:亲亲宝宝