IndexReader reader2 = IndexReader.open(ramDir2, true);
IndexSearcher searchers[] = new IndexSearcher[2];
searchers[0] = new IndexSearcher(ramDir1, true);
searchers[1] = new IndexSearcher(ramDir2, true);
MultiSearcher multiSearcher = new MultiSearcher(searchers);
QueryParser parser = new QueryParser(TEST_VERSION_CURRENT, FIELD_NAME, new StandardAnalyzer(TEST_VERSION_CURRENT));
parser.setMultiTermRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
query = parser.parse("multi*");
if (VERBOSE) System.out.println("Searching for: " + query.toString(FIELD_NAME));
// at this point the multisearcher calls combine(query[])
hits = multiSearcher.search(query, null, 1000);
// query = QueryParser.parse("multi*", FIELD_NAME, new StandardAnalyzer(TEST_VERSION));
Query expandedQueries[] = new Query[2];
expandedQueries[0] = query.rewrite(reader1);
expandedQueries[1] = query.rewrite(reader2);
query = query.combine(expandedQueries);
// create an instance of the highlighter with the tags used to surround
// highlighted text
Highlighter highlighter = new Highlighter(this, new QueryTermScorer(query));
for (int i = 0; i < hits.totalHits; i++) {
String text = multiSearcher.doc(hits.scoreDocs[i].doc).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
String highlightedText = highlighter.getBestFragment(tokenStream, text);
if (VERBOSE) System.out.println(highlightedText);
}
assertTrue("Failed to find correct number of highlights " + numHighlights + " found",