public void testSearch(String[] record, int topDocLimit, int resultLimit) {
    SynonymRecordSearcher recSearcher = new SynonymRecordSearcher(record.length);
    for (int i = 0; i < record.length; i++) {
      initIdx(
          PluginUtil.getPluginInstallPath(HandLuceneImplTest.PLUGIN_ID).concat("data/idx")
              + (i + 1));
      SynonymIndexSearcher searcher =
          new SynonymIndexSearcher(
              PluginUtil.getPluginInstallPath(HandLuceneImplTest.PLUGIN_ID).concat("data/idx")
                  + (i + 1));
      searcher.setTopDocLimit(topDocLimit);
      recSearcher.addSearcher(searcher, i);
    }

    try {
      TopDocs topDocs;
      int hits = 1;
      for (int i = 0; i < record.length; i++) {
        topDocs = recSearcher.getSearcher(i).searchDocumentBySynonym(record[i]);
        hits *= topDocs.totalHits;
      }

      List<OutputRecord> results = recSearcher.search(resultLimit, record);
      Assert.assertNotNull(results);
      Assert.assertFalse(results.isEmpty());
      for (OutputRecord outputRecord : results) {
        Assert.assertNotNull(outputRecord);
        String[] resultingRecord = outputRecord.getRecord();
        Assert.assertEquals(record.length, resultingRecord.length);
        System.out.println(StringUtils.join(resultingRecord, '|'));
        System.out.println("\t" + outputRecord.getScore());
      }
      Assert.assertEquals(Math.min(hits, resultLimit), results.size());

      for (int i = 0; i < record.length; i++) {
        recSearcher.getSearcher(i).close();
      }
    } catch (ParseException e) {
      e.printStackTrace();
      fail("should not get an exception here");
    } catch (IOException e) {
      e.printStackTrace();
      fail("should not get an exception here");
    }
    System.out.println("");
  }