session.save();
}
private QueryResultWrapper doQuery(JCRSessionWrapper session, final String... facet) throws RepositoryException {
QueryObjectModelFactory factory = session.getWorkspace().getQueryManager().getQOMFactory();
QOMBuilder qomBuilder = new QOMBuilder(factory, session.getValueFactory());
qomBuilder.setSource(factory.selector("jnt:event", "event"));
qomBuilder.andConstraint(factory.descendantNode("event", "/sites/jcrFacetTest"));
for (int j = 0; j < facet.length; j++) {
String prop = facet[j++];
String val = facet[j];
if (prop.startsWith("rep:filter(")) {
qomBuilder.andConstraint(factory.fullTextSearch("event", "rep:filter("
+ Text.escapeIllegalJcrChars(StringUtils
.substringAfter(prop, "rep:filter(")), factory.literal(session
.getValueFactory().createValue(val))));
} else {
qomBuilder.getColumns().add(factory.column("event", prop, val));
}
}
QueryObjectModel qom = qomBuilder.createQOM();
QueryResultWrapper res = (QueryResultWrapper) qom.execute();
return res;
}