Search in sources :

Example 1 with ConstraintType

use of org.drools.core.util.index.IndexUtil.ConstraintType in project drools by kiegroup.

the class CompositeObjectSinkAdapter method isRangeIndexable.

private boolean isRangeIndexable(AlphaNode alphaNode) {
    AlphaNodeFieldConstraint fieldConstraint = alphaNode.getConstraint();
    if (fieldConstraint instanceof IndexableConstraint) {
        IndexableConstraint indexableConstraint = (IndexableConstraint) fieldConstraint;
        ConstraintType constraintType = indexableConstraint.getConstraintType();
        return (constraintType.isAscending() || constraintType.isDescending()) && indexableConstraint.getField() != null && !indexableConstraint.getField().isNull() && indexableConstraint.getFieldExtractor().getValueType() != ValueType.OBJECT_TYPE && // our current implementation does not support range indexing of deeply nested properties
        indexableConstraint.getFieldExtractor().getIndex() >= 0;
    }
    return false;
}
Also used : AlphaNodeFieldConstraint(org.drools.core.spi.AlphaNodeFieldConstraint) IndexableConstraint(org.drools.core.rule.IndexableConstraint) ConstraintType(org.drools.core.util.index.IndexUtil.ConstraintType)

Aggregations

IndexableConstraint (org.drools.core.rule.IndexableConstraint)1 AlphaNodeFieldConstraint (org.drools.core.spi.AlphaNodeFieldConstraint)1 ConstraintType (org.drools.core.util.index.IndexUtil.ConstraintType)1