Search in sources :

Example 6 with OrderedPropertyValues

use of org.neo4j.kernel.api.schema_new.OrderedPropertyValues in project neo4j by neo4j.

the class IndexTxStateUpdater method onPropertyRemove.

public void onPropertyRemove(KernelStatement state, NodeItem node, DefinedProperty before) throws EntityNotFoundException {
    Iterator<NewIndexDescriptor> indexes = getIndexesInvolvingProperty(state, before.propertyKeyId());
    nodeIndexMatcher.onMatchingSchema(state, indexes, node, before.propertyKeyId(), index -> {
        OrderedPropertyValues values = getOrderedPropertyValues(state, node, before, index.schema().getPropertyIds());
        state.txState().indexDoUpdateEntry(index.schema(), node.id(), values, null);
    });
}
Also used : NewIndexDescriptor(org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor) OrderedPropertyValues(org.neo4j.kernel.api.schema_new.OrderedPropertyValues)

Example 7 with OrderedPropertyValues

use of org.neo4j.kernel.api.schema_new.OrderedPropertyValues in project neo4j by neo4j.

the class IndexTxStateUpdater method onLabelChange.

public void onLabelChange(KernelStatement state, int labelId, NodeItem node, LabelChangeType changeType) throws EntityNotFoundException {
    PrimitiveIntSet nodePropertyIds = Primitive.intSet();
    nodePropertyIds.addAll(readOps.nodeGetPropertyKeys(state, node).iterator());
    Iterator<NewIndexDescriptor> indexes = Iterators.concat(schemaReadOps.indexesGetForLabel(state, labelId), schemaReadOps.uniqueIndexesGetForLabel(state, labelId));
    while (indexes.hasNext()) {
        NewIndexDescriptor index = indexes.next();
        int[] indexPropertyIds = index.schema().getPropertyIds();
        if (nodeHasIndexProperties(nodePropertyIds, indexPropertyIds)) {
            OrderedPropertyValues values = getOrderedPropertyValues(state, node, indexPropertyIds);
            if (changeType == LabelChangeType.ADDED_LABEL) {
                state.txState().indexDoUpdateEntry(index.schema(), node.id(), null, values);
            } else {
                state.txState().indexDoUpdateEntry(index.schema(), node.id(), values, null);
            }
        }
    }
}
Also used : NewIndexDescriptor(org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor) PrimitiveIntSet(org.neo4j.collection.primitive.PrimitiveIntSet) OrderedPropertyValues(org.neo4j.kernel.api.schema_new.OrderedPropertyValues)

Aggregations

OrderedPropertyValues (org.neo4j.kernel.api.schema_new.OrderedPropertyValues)7 NewIndexDescriptor (org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor)3 DiffSets (org.neo4j.kernel.impl.util.diffsets.DiffSets)3 RelationshipDiffSets (org.neo4j.kernel.impl.util.diffsets.RelationshipDiffSets)3 ReadableDiffSets (org.neo4j.storageengine.api.txstate.ReadableDiffSets)3 ReadableRelationshipDiffSets (org.neo4j.storageengine.api.txstate.ReadableRelationshipDiffSets)3 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 PrimitiveIntSet (org.neo4j.collection.primitive.PrimitiveIntSet)1 Pair (org.neo4j.helpers.collection.Pair)1