concept Exception in category lucene

appears as: Exception
Lucene in Action, Second Edition

This is an excerpt from Manning's book Lucene in Action, Second Edition.

public void testSlopComparison() throws Exception {
  String[] phrase = new String[] {"quick", "fox"};

  assertFalse("exact phrase not found", matched(phrase, 0));

  assertTrue("close enough", matched(phrase, 1));
}
Listing 5.5. Mimicking MultiPhraseQuery using BooleanQuery
public void testAgainstOR() throws Exception { PhraseQuery quickFox = new PhraseQuery(); quickFox.setSlop(1); quickFox.add(new Term("field", "quick")); quickFox.add(new Term("field", "fox")); PhraseQuery fastFox = new PhraseQuery(); fastFox.add(new Term("field", "fast")); fastFox.add(new Term("field", "fox")); BooleanQuery query = new BooleanQuery(); query.add(quickFox, BooleanClause.Occur.SHOULD); query.add(fastFox, BooleanClause.Occur.SHOULD); TopDocs hits = searcher.search(query, 10); assertEquals(2, hits.totalHits); }