DescendantNode descendantNode = (DescendantNode)constraint;
String path = descendantNode.getAncestorPath();
calculator.addIndex(DESCENDANTS_BY_PATH_INDEX_NAME, null, null, singletonList(constraint), 1000, 10000L,
-1.0f, PATH_PARAMETER, path);
} else if (constraint instanceof Comparison) {
Comparison comparison = (Comparison)constraint;
if (comparison.operator() != Operator.EQUAL_TO) return;
DynamicOperand leftSide = comparison.getOperand1();
if (leftSide instanceof NodePath) {
// This is a constraint on the path of a node ...
StaticOperand rightSide = comparison.getOperand2();
String path = stringValue(rightSide, context);
if (path != null) {
calculator.addIndex(NODE_BY_PATH_INDEX_NAME, null, null, singletonList(constraint), 1, 1L, -1.0f,
PATH_PARAMETER, path);
}
}
if (leftSide instanceof NodeId) {
// This is a constraint on the ID of a node ...
StaticOperand rightSide = comparison.getOperand2();
String id = stringValue(rightSide, context);
if (id != null) {
calculator.addIndex(NODE_BY_ID_INDEX_NAME, null, null, singletonList(constraint), 1, 1L, -1.0f,
ID_PARAMETER, id);
}
}
if (leftSide instanceof PropertyValue) {
PropertyValue propValue = (PropertyValue)leftSide;
if ("jcr:uuid".equals(propValue.getPropertyName()) || "mode:id".equals(propValue.getPropertyName())) {
// This is a constraint on the ID of a node ...
StaticOperand rightSide = comparison.getOperand2();
String id = stringValue(rightSide, context);
if (id != null) {
calculator.addIndex(NODE_BY_ID_INDEX_NAME, null, null, singletonList(constraint), 1, 1L, -1.0f,
ID_PARAMETER, id);
}
} else if ("jcr:path".equals(propValue.getPropertyName())) {
// This is a constraint on the PATH of a node ...
StaticOperand rightSide = comparison.getOperand2();
String path = stringValue(rightSide, context);
if (path != null) {
calculator.addIndex(NODE_BY_PATH_INDEX_NAME, null, null, singletonList(constraint), 1, 1L, -1.0f,
PATH_PARAMETER, path);
}