test_class.declarator: MANY = 100
test_class.modifier: private static final
test_class.original_string: private static final int MANY = 100;
test_class.type: int
test_class.var_name: MANY
test_class.declarator: HOOK = new EditorHook(
              new IndexUpdateProvider(new PropertyIndexEditorProvider()))
test_class.modifier: private static final
test_class.original_string: private static final EditorHook HOOK = new EditorHook(
              new IndexUpdateProvider(new PropertyIndexEditorProvider()));
test_class.type: EditorHook
test_class.var_name: HOOK
test_class.file: oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexTest.java
test_class.identifier: PropertyIndexTest
test_case.body: @Test
      public void valuePattern() throws Exception {
          NodeState root = EMPTY_NODE;
  
          // Add index definitions
          NodeBuilder builder = root.builder();
          NodeBuilder index = builder.child(INDEX_DEFINITIONS_NAME);
          NodeBuilder indexDef = createIndexDefinition(
                  index, "fooIndex", true, false,
                  ImmutableSet.of("foo"), null);
          indexDef.setProperty(IndexConstants.VALUE_PATTERN, "(a.*|b)");
          NodeState before = builder.getNodeState();
  
          // Add some content and process it through the property index hook
          builder.child("a")
                  .setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, Type.NAME)
                  .setProperty("foo", "a");
          builder.child("a1")
                  .setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, Type.NAME)
                  .setProperty("foo", "a1");
          builder.child("b")
                  .setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, Type.NAME)
                  .setProperty("foo", "b");
          builder.child("c")
                  .setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, Type.NAME)
                  .setProperty("foo", "c");
          NodeState after = builder.getNodeState();
  
          // Add an index
          NodeState indexed = HOOK.processCommit(before, after, CommitInfo.EMPTY);
  
          FilterImpl f = createFilter(after, NT_UNSTRUCTURED);
  
          // Query the index
          PropertyIndexLookup lookup = new PropertyIndexLookup(indexed);
          PropertyIndex pIndex = new PropertyIndex(Mounts.defaultMountInfoProvider());
          assertEquals(ImmutableSet.of("a"), find(lookup, "foo", "a", f));
          assertEquals(ImmutableSet.of("a1"), find(lookup, "foo", "a1", f));
          assertEquals(ImmutableSet.of("b"), find(lookup, "foo", "b", f));
  
          // expected: no index for "is not null"
          assertTrue(pIndex.getCost(f, indexed) == Double.POSITIVE_INFINITY);
          
          ArrayList<PropertyValue> list = new ArrayList<PropertyValue>();
          list.add(PropertyValues.newString("c"));
          f.restrictPropertyAsList("foo", list);
          // expected: no index for value c
          assertTrue(pIndex.getCost(f, indexed) == Double.POSITIVE_INFINITY);
  
          f = createFilter(after, NT_UNSTRUCTURED);
          list = new ArrayList<PropertyValue>();
          list.add(PropertyValues.newString("a"));
          f.restrictPropertyAsList("foo", list);
          // expected: no index for value a
          assertTrue(pIndex.getCost(f, indexed) < Double.POSITIVE_INFINITY);
  
      }
test_case.class_method_signature: PropertyIndexTest.valuePattern()
test_case.full_signature: @Test public void valuePattern()
test_case.identifier: valuePattern
test_case.invocations: builder child createIndexDefinition of setProperty getNodeState setProperty setProperty child setProperty setProperty child setProperty setProperty child setProperty setProperty child getNodeState processCommit createFilter defaultMountInfoProvider assertEquals of find assertEquals of find assertEquals of find assertTrue getCost add newString restrictPropertyAsList assertTrue getCost createFilter add newString restrictPropertyAsList assertTrue getCost
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void valuePattern()
focal_class.declarator: PROPERTY = "property"
focal_class.modifier: private static final
focal_class.original_string: private static final String PROPERTY = "property";
focal_class.type: String
focal_class.var_name: PROPERTY
focal_class.declarator: LOG = LoggerFactory.getLogger(PropertyIndex.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(PropertyIndex.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: mountInfoProvider
focal_class.modifier: private final
focal_class.original_string: private final MountInfoProvider mountInfoProvider;
focal_class.type: MountInfoProvider
focal_class.var_name: mountInfoProvider
focal_class.declarator: cachedPlan
focal_class.modifier: private
focal_class.original_string: private PropertyIndexPlan cachedPlan;
focal_class.type: PropertyIndexPlan
focal_class.var_name: cachedPlan
focal_class.file: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndex.java
focal_class.identifier: PropertyIndex
focal_class.interfaces: implements QueryIndex
focal_class.class_method_signature: PropertyIndex.PropertyIndex(MountInfoProvider mountInfoProvider)
focal_class.full_signature:   PropertyIndex(MountInfoProvider mountInfoProvider)
focal_class.identifier: PropertyIndex
focal_class.parameters: (MountInfoProvider mountInfoProvider)
focal_class.signature:  PropertyIndex(MountInfoProvider mountInfoProvider)
focal_class.class_method_signature: PropertyIndex.getPlan(NodeState root, Filter filter)
focal_class.full_signature: private PropertyIndexPlan getPlan(NodeState root, Filter filter)
focal_class.identifier: getPlan
focal_class.modifiers: private
focal_class.parameters: (NodeState root, Filter filter)
focal_class.return: PropertyIndexPlan
focal_class.signature: PropertyIndexPlan getPlan(NodeState root, Filter filter)
focal_class.class_method_signature: PropertyIndex.createPlan(NodeState root, Filter filter,
                                                  MountInfoProvider mountInfoProvider)
focal_class.full_signature: private static PropertyIndexPlan createPlan(NodeState root, Filter filter,
                                                  MountInfoProvider mountInfoProvider)
focal_class.identifier: createPlan
focal_class.modifiers: private static
focal_class.parameters: (NodeState root, Filter filter,
                                                  MountInfoProvider mountInfoProvider)
focal_class.return: PropertyIndexPlan
focal_class.signature: PropertyIndexPlan createPlan(NodeState root, Filter filter,
                                                  MountInfoProvider mountInfoProvider)
focal_class.class_method_signature: PropertyIndex.wrongIndex(ChildNodeEntry entry, Filter filter, NodeState root)
focal_class.full_signature: private static boolean wrongIndex(ChildNodeEntry entry, Filter filter, NodeState root)
focal_class.identifier: wrongIndex
focal_class.modifiers: private static
focal_class.parameters: (ChildNodeEntry entry, Filter filter, NodeState root)
focal_class.return: boolean
focal_class.signature: boolean wrongIndex(ChildNodeEntry entry, Filter filter, NodeState root)
focal_class.class_method_signature: PropertyIndex.isEnabled(NodeState definition, NodeState root)
focal_class.full_signature: private static boolean isEnabled(NodeState definition, NodeState root)
focal_class.identifier: isEnabled
focal_class.modifiers: private static
focal_class.parameters: (NodeState definition, NodeState root)
focal_class.return: boolean
focal_class.signature: boolean isEnabled(NodeState definition, NodeState root)
focal_class.class_method_signature: PropertyIndex.getOptionalStrings(NodeState defn, String propertyName)
focal_class.full_signature: private static String[] getOptionalStrings(NodeState defn, String propertyName)
focal_class.identifier: getOptionalStrings
focal_class.modifiers: private static
focal_class.parameters: (NodeState defn, String propertyName)
focal_class.return: String[]
focal_class.signature: String[] getOptionalStrings(NodeState defn, String propertyName)
focal_class.class_method_signature: PropertyIndex.getMinimumCost()
focal_class.full_signature: @Override public double getMinimumCost()
focal_class.identifier: getMinimumCost
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: double
focal_class.signature: double getMinimumCost()
focal_class.class_method_signature: PropertyIndex.getIndexName()
focal_class.full_signature: @Override public String getIndexName()
focal_class.identifier: getIndexName
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getIndexName()
focal_class.class_method_signature: PropertyIndex.getIndexName(Filter filter, NodeState root)
focal_class.full_signature: @Override public String getIndexName(Filter filter, NodeState root)
focal_class.identifier: getIndexName
focal_class.modifiers: @Override public
focal_class.parameters: (Filter filter, NodeState root)
focal_class.return: String
focal_class.signature: String getIndexName(Filter filter, NodeState root)
focal_class.class_method_signature: PropertyIndex.getCost(Filter filter, NodeState root)
focal_class.full_signature: @Override public double getCost(Filter filter, NodeState root)
focal_class.identifier: getCost
focal_class.modifiers: @Override public
focal_class.parameters: (Filter filter, NodeState root)
focal_class.return: double
focal_class.signature: double getCost(Filter filter, NodeState root)
focal_class.class_method_signature: PropertyIndex.query(Filter filter, NodeState root)
focal_class.full_signature: @Override public Cursor query(Filter filter, NodeState root)
focal_class.identifier: query
focal_class.modifiers: @Override public
focal_class.parameters: (Filter filter, NodeState root)
focal_class.return: Cursor
focal_class.signature: Cursor query(Filter filter, NodeState root)
focal_class.class_method_signature: PropertyIndex.getPlan(Filter filter, NodeState root)
focal_class.full_signature: @Override public String getPlan(Filter filter, NodeState root)
focal_class.identifier: getPlan
focal_class.modifiers: @Override public
focal_class.parameters: (Filter filter, NodeState root)
focal_class.return: String
focal_class.signature: String getPlan(Filter filter, NodeState root)
focal_method.body: @Override
      public double getCost(Filter filter, NodeState root) {
          if (filter.getFullTextConstraint() != null) {
              // not an appropriate index for full-text search
              return Double.POSITIVE_INFINITY;
          }
          if (filter.containsNativeConstraint()) {
              // not an appropriate index for native search
              return Double.POSITIVE_INFINITY;
          }
          if (filter.getPropertyRestrictions().isEmpty()) {
              // not an appropriate index for no property restrictions & selector constraints
              return Double.POSITIVE_INFINITY;
          }
          PropertyIndexPlan plan = getPlan(root, filter);
          if (plan != null) {
              return plan.getCost();
          } else {
              return Double.POSITIVE_INFINITY;
          }
      }
focal_method.class_method_signature: PropertyIndex.getCost(Filter filter, NodeState root)
focal_method.full_signature: @Override public double getCost(Filter filter, NodeState root)
focal_method.identifier: getCost
focal_method.invocations: getFullTextConstraint containsNativeConstraint isEmpty getPropertyRestrictions getPlan getCost
focal_method.modifiers: @Override public
focal_method.parameters: (Filter filter, NodeState root)
focal_method.return: double
focal_method.signature: double getCost(Filter filter, NodeState root)