public void testSearch() throws Exception {
  StringWriter sw=new StringWriter();
  PrintWriter pw=new PrintWriter(sw,true);
  doTestSearch(random(),pw,false);
  pw.close();
  sw.close();
  String multiFileOutput=sw.toString();
  sw=new StringWriter();
  pw=new PrintWriter(sw,true);
  doTestSearch(random(),pw,true);
  pw.close();
  sw.close();
  String singleFileOutput=sw.toString();
  assertEquals(multiFileOutput,singleFileOutput);
}

public void testSearch ( ) throws Exception { StringWriter sw = new StringWriter ( ) ; PrintWriter pw = new PrintWriter ( sw , true ) ; doTestSearch ( random ( ) , pw , false ) ; pw . close ( ) ; sw . close ( ) ; String multiFileOutput = sw . toString ( ) ; sw = new StringWriter ( ) ; pw = new PrintWriter ( sw , true ) ; doTestSearch ( random ( ) , pw , true ) ; pw . close ( ) ; sw . close ( ) ; String singleFileOutput = sw . toString ( ) ; assertEquals ( multiFileOutput , singleFileOutput ) ; }
this test performs a number of searches . it also compares output of searches using multi - file index segments with single - file index segments . todo : someone should check that the results of the searches are still correct by adding assert statements . right now , the test passes if the results are the same between multi - file and single - file formats , even if the results are wrong .
