use of org.apache.jackrabbit.oak.spi.query.QueryIndex.FulltextQueryIndex in project jackrabbit-oak by apache.
the class SimilarImpl method evaluate.
@Override
public boolean evaluate() {
// conditions
if (!(selector.getIndex() instanceof FulltextQueryIndex)) {
log.warn("No full-text index was found that can process the condition " + toString());
return false;
}
// verify the path is readable
PropertyValue p = pathExpression.currentValue();
String path = p.getValue(Type.STRING);
if (selector.getTree(path) == null) {
return false;
}
if (propertyName != null) {
if (selector.currentProperty(propertyName) == null) {
// property not found
return false;
}
}
// we assume the index only returns the requested entries
return true;
}
use of org.apache.jackrabbit.oak.spi.query.QueryIndex.FulltextQueryIndex in project jackrabbit-oak by apache.
the class FullTextSearchImpl method evaluate.
@Override
public boolean evaluate() {
// such as index aggregation
if (selector.getIndex() instanceof FulltextQueryIndex) {
// aggregation bits
if (relativePath == null && propertyName != null) {
return enforcePropertyExistence(propertyName, selector);
}
return true;
}
// OAK-2050
if (!query.getSettings().getFullTextComparisonWithoutIndex()) {
return false;
}
StringBuilder buff = new StringBuilder();
if (relativePath == null && propertyName != null) {
PropertyValue p = selector.currentProperty(propertyName);
if (p == null) {
return false;
}
appendString(buff, p);
} else {
String path = selector.currentPath();
if (!PathUtils.denotesRoot(path)) {
appendString(buff, PropertyValues.newString(PathUtils.getName(path)));
}
if (relativePath != null) {
String rp = normalizePath(relativePath);
path = PathUtils.concat(path, rp);
}
Tree tree = selector.getTree(path);
if (tree == null || !tree.exists()) {
return false;
}
if (propertyName != null) {
String pn = normalizePropertyName(propertyName);
PropertyState p = tree.getProperty(pn);
if (p == null) {
return false;
}
appendString(buff, PropertyValues.create(p));
} else {
for (PropertyState p : tree.getProperties()) {
appendString(buff, PropertyValues.create(p));
}
}
}
return getFullTextConstraint(selector).evaluate(buff.toString());
}
Aggregations