// phraseHighlight = true, fieldMatch = true
FieldQuery fq = new FieldQuery( query, true, true );
// "a"
List<TermInfo> phraseCandidate = new ArrayList<TermInfo>();
phraseCandidate.add( new TermInfo( "a", 0, 1, 0 ) );
assertNull( fq.searchPhrase( F, phraseCandidate ) );
// "a b"
phraseCandidate.add( new TermInfo( "b", 2, 3, 1 ) );
assertNull( fq.searchPhrase( F, phraseCandidate ) );
// "a b c"
phraseCandidate.add( new TermInfo( "c", 4, 5, 2 ) );
assertNotNull( fq.searchPhrase( F, phraseCandidate ) );
assertNull( fq.searchPhrase( "x", phraseCandidate ) );
// phraseHighlight = true, fieldMatch = false
fq = new FieldQuery( query, true, false );
// "a b c"
assertNotNull( fq.searchPhrase( F, phraseCandidate ) );
assertNotNull( fq.searchPhrase( "x", phraseCandidate ) );
// phraseHighlight = false, fieldMatch = true
fq = new FieldQuery( query, false, true );
// "a"
phraseCandidate.clear();
phraseCandidate.add( new TermInfo( "a", 0, 1, 0 ) );
assertNotNull( fq.searchPhrase( F, phraseCandidate ) );
// "a b"
phraseCandidate.add( new TermInfo( "b", 2, 3, 1 ) );
assertNull( fq.searchPhrase( F, phraseCandidate ) );
// "a b c"
phraseCandidate.add( new TermInfo( "c", 4, 5, 2 ) );
assertNotNull( fq.searchPhrase( F, phraseCandidate ) );
assertNull( fq.searchPhrase( "x", phraseCandidate ) );
}