public void assertAllQueries(MemoryIndex memory,Directory ramdir,Analyzer analyzer) throws Exception {
  IndexReader reader=DirectoryReader.open(ramdir);
  IndexSearcher ram=newSearcher(reader);
  IndexSearcher mem=memory.createSearcher();
  QueryParser qp=new QueryParser("foo",analyzer);
  for (  String query : queries) {
    TopDocs ramDocs=ram.search(qp.parse(query),1);
    TopDocs memDocs=mem.search(qp.parse(query),1);
    assertEquals(query,ramDocs.totalHits,memDocs.totalHits);
  }
  reader.close();
}

public void assertAllQueries ( MemoryIndex memory , Directory ramdir , Analyzer analyzer ) throws Exception { IndexReader reader = DirectoryReader . open ( ramdir ) ; IndexSearcher ram = newSearcher ( reader ) ; IndexSearcher mem = memory . createSearcher ( ) ; QueryParser qp = new QueryParser ( "foo" , analyzer ) ; for ( String query : queries ) { TopDocs ramDocs = ram . search ( qp . parse ( query ) , 1 ) ; TopDocs memDocs = mem . search ( qp . parse ( query ) , 1 ) ; assertEquals ( query , ramDocs . totalHits , memDocs . totalHits ) ; } reader . close ( ) ; }
run all queries against both the ramdirectory and memoryindex , ensuring they are the same .
