public static IndexReader buildMultiReader(int length,
IndexReader[] readers) {
if ( length == 0 ) {
return null;
}
else if ( length == 1 ) {
//everything should be the same so wrap in an MultiReader
//return readers[0];
try {
return new CacheableMultiReader( readers );
}
catch (Exception e) {
//Lucene 2.2 used to through IOExceptions here
clean( new SearchException( "Unable to open a MultiReader", e ), readers );
return null; //never happens, but please the compiler
}
}
else {
try {
return new CacheableMultiReader( readers );
}
catch (Exception e) {
//Lucene 2.2 used to through IOExceptions here
clean( new SearchException( "Unable to open a MultiReader", e ), readers );
return null; //never happens, but please the compiler
}
}
}
|