for (Content content : (List<Content>) Database
.query(fullTextIndex).search(query)) {
// When content is child of a "paged container" (e.g.
// Composite),
// traverse upwards to the top-level container.
Content target = content;
while (target.getParent() != null
&& ((Content) target.getParent()).isPage()
&& ((Content) target.getParent()).isContainer()) {
target = (Content) target.getParent();
}
if (!result.contains(target)
&& (context == null || target.isDescendant(context))) {
result.add(target);
}
}
return result;
} catch (Exception e) {