lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Shapiro <mshap...@palamida.com>
Subject Re: How to get the index for a document after a search over multiple indexes
Date Tue, 14 Jun 2016 20:08:38 GMT
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;
}

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message