private static IndexSearcher getSearcher( String[] indexDirs ) throws Exception { IndexReader[] readers = new IndexReader[indexDirs.length]; FSDirectory[] directorys = new FSDirectory[indexDirs.length];
for ( int i = 0; i < indexDirs.length; ++i ) { File file = new File( indexDirs[i] ); directorys[i] = ( bWindows ) ? new MMapDirectory( file ) : new NIOFSDirectory( file ); directorys[i].setReadChunkSize( Integer.MAX_VALUE ); readers[i] = IndexReader.open( directorys[i], true ); } MultiReader multiReader = new MultiReader( readers, true ); IndexSearcher searcher = new IndexSearcher( multiReader, executorService ); // ExecutorService return searcher; }