MemoryIndex mindex = new MemoryIndex(random().nextBoolean(), random().nextInt(50) * 1024 * 1024);
MockAnalyzer mockAnalyzer = new MockAnalyzer(random());
mindex.addField("field", "the quick brown fox", mockAnalyzer);
mindex.addField("field", "jumps over the", mockAnalyzer);
AtomicReader reader = (AtomicReader) mindex.createSearcher().getIndexReader();
assertEquals(7, reader.terms("field").getSumTotalTermFreq());
PhraseQuery query = new PhraseQuery();
query.add(new Term("field", "fox"));
query.add(new Term("field", "jumps"));
assertTrue(mindex.search(query) > 0.1);
mindex.reset();