IndexWriter writer = new IndexWriter(
directory,
newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).
setMaxBufferedDocs(2).
setMergePolicy(newLogMergePolicy(1000)).
setSimilarity(new DefaultSimilarity())
);
writer.addDocument(adoc(new String[] {"id", "a", "title", "ipod", "str_s", "a"}));
writer.addDocument(adoc(new String[] {"id", "b", "title", "ipod ipod", "str_s", "b"}));
writer.addDocument(adoc(new String[] {"id", "c", "title", "ipod ipod ipod", "str_s","c"}));
writer.addDocument(adoc(new String[] {"id", "x", "title", "boosted", "str_s", "x"}));
writer.addDocument(adoc(new String[] {"id", "y", "title", "boosted boosted", "str_s","y"}));
writer.addDocument(adoc(new String[] {"id", "z", "title", "boosted boosted boosted","str_s", "z"}));
IndexReader r = DirectoryReader.open(writer, true);
writer.close();
IndexSearcher searcher = newSearcher(r);
searcher.setSimilarity(new DefaultSimilarity());
runTest(searcher, true);
runTest(searcher, false);
r.close();