}
@TestInfo(testType = TestInfo.TestType.INTEGRATION)
public void testFragmentSeparation() throws SearcherException {
GroupedSearchResults results;
results = snippetSearcher.search(new LazyParsedQuery("separation"), 0, 10, new NoGroup(), 1, null, null);
assertEquals("We get a bad number of groups", 1, results.groups());
assertEquals("We get a bad number of results within the group", 1, results.getGroup(0).last().size());
org.apache.lucene.document.Document doc= results.getGroup(0).last().get(0);
String content= StringUtil.nullToEmpty(doc.get(SnippetSearcher.SNIPPET_FIELDNAME_PREFIX + "text")).trim();
assertEquals("The returned snippet is not as expected", "test segments and their <B>separation</B>.", content);
results = snippetSearcher.search(new LazyParsedQuery("test"), 0, 10, new NoGroup(), 1, null, null);
assertEquals("We get a bad number of groups", 1, results.groups());
assertEquals("We get a bad number of results within the group", 1, results.getGroup(0).last().size());
doc= results.getGroup(0).last().get(0);
content= StringUtil.nullToEmpty(doc.get(SnippetSearcher.SNIPPET_FIELDNAME_PREFIX + "text")).trim();
assertEquals("The returned snippet is not as expected", "This <B>test</B> will check!", content);
results = snippetSearcher.search(new LazyParsedQuery("different"), 0, 10, new NoGroup(), 1, null, null);
assertEquals("We get a bad number of groups", 1, results.groups());
assertEquals("We get a bad number of results within the group", 1, results.getGroup(0).last().size());
doc= results.getGroup(0).last().get(0);
content= StringUtil.nullToEmpty(doc.get(SnippetSearcher.SNIPPET_FIELDNAME_PREFIX + "text")).trim();
assertEquals("The returned snippet is not as expected", "using <B>different</B> chars to separe the frags-", content);
results = snippetSearcher.search(new LazyParsedQuery("chars"), 0, 10, new NoGroup(), 1, null, null);
assertEquals("We get a bad number of groups", 1, results.groups());
assertEquals("We get a bad number of results within the group", 1, results.getGroup(0).last().size());
doc= results.getGroup(0).last().get(0);
content= StringUtil.nullToEmpty(doc.get(SnippetSearcher.SNIPPET_FIELDNAME_PREFIX + "text")).trim();
assertEquals("The returned snippet is not as expected", "<B>chars</B> and <B>chars</B> and <B>chars</B>", content);