bhabegger commented on code in PR #3076:
URL: https://github.com/apache/jackrabbit-oak/pull/3076#discussion_r4060077427
##########
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexPlan.java:
##########
@@ -67,53 +67,49 @@ public class PropertyIndexPlan {
private final String name;
- private final Set<String> properties;
-
private final Set<IndexStoreStrategy> strategies;
private final Filter filter;
- private boolean matchesAllTypes;
-
- private boolean matchesNodeTypes;
-
- private final double cost;
-
private final Set<String> values;
private final int depth;
- private final PathFilter pathFilter;
-
- private final boolean unique;
-
private final boolean deprecated;
+ // Value returned by getCost().
+ private final double cost;
+
PropertyIndexPlan(String name, NodeState root, NodeState definition,
Filter filter){
this(name, root, definition, filter,
Mounts.defaultMountInfoProvider());
}
PropertyIndexPlan(String name, NodeState root, NodeState definition,
Filter filter, MountInfoProvider mountInfoProvider) {
+ this(name, root, definition, filter, mountInfoProvider, false);
+ }
+
+ PropertyIndexPlan(String name, NodeState root, NodeState definition,
+ Filter filter, MountInfoProvider mountInfoProvider,
boolean disableConfigurableCosts) {
this.name = name;
- this.unique =
definition.getBoolean(IndexConstants.UNIQUE_PROPERTY_NAME);
+ boolean unique =
definition.getBoolean(IndexConstants.UNIQUE_PROPERTY_NAME);
this.definition = definition;
- this.properties = SetUtils.toSet(definition.getNames(PROPERTY_NAMES));
- pathFilter = PathFilter.from(definition.builder());
- this.strategies = getStrategies(definition, mountInfoProvider);
+ Set<String> properties =
SetUtils.toSet(definition.getNames(PROPERTY_NAMES));
+ PathFilter pathFilter = PathFilter.from(definition.builder());
+ this.strategies = getStrategies(definition, mountInfoProvider, unique);
this.filter = filter;
Iterable<String> types = definition.getNames(DECLARING_NODE_TYPES);
// if there is no such property, then all nodetypes are matched
- this.matchesAllTypes = !definition.hasProperty(DECLARING_NODE_TYPES);
+ boolean matchesAllTypes =
!definition.hasProperty(DECLARING_NODE_TYPES);
this.deprecated =
definition.getBoolean(IndexConstants.INDEX_DEPRECATED);
- this.matchesNodeTypes =
+ boolean matchesNodeTypes =
matchesAllTypes ||
StreamUtils.toStream(types).anyMatch(filter.getSupertypes()::contains);
ValuePattern valuePattern = new ValuePattern(definition);
- double bestCost = Double.POSITIVE_INFINITY;
+ double bestCount = Double.POSITIVE_INFINITY;
Review Comment:
Switched to long (but in fact could be int as it never goes above MAX_COUNT
(originally MAX_COST) = 100.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]