Example #1
0
        private static AddedWithValuesAndRemoved IndexUpdatesWithValuesScanAndFilter(ReadableTransactionState txState, IndexDescriptor descriptor, IndexQuery filter, IndexOrder indexOrder)
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<org.neo4j.values.storable.ValueTuple,? extends org.neo4j.storageengine.api.txstate.LongDiffSets> updates = getUpdates(txState, descriptor, indexOrder);
            IDictionary <ValueTuple, ? extends LongDiffSets> updates = GetUpdates(txState, descriptor, indexOrder);

            if (updates == null)
            {
                return(_emptyAddedAndRemovedWithValues);
            }

            MutableList <NodeWithPropertyValues> added = Lists.mutable.empty();
            MutableLongSet removed = LongSets.mutable.empty();

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (java.util.Map.Entry<org.neo4j.values.storable.ValueTuple,? extends org.neo4j.storageengine.api.txstate.LongDiffSets> entry : updates.entrySet())
            foreach (KeyValuePair <ValueTuple, ? extends LongDiffSets> entry in updates.SetOfKeyValuePairs())
            {
                ValueTuple key = entry.Key;
                if (filter == null || filter.AcceptsValue(key.OnlyValue))
                {
                    Value[]      values  = key.Values;
                    LongDiffSets diffSet = entry.Value;
                    diffSet.Added.each(nodeId => added.add(new NodeWithPropertyValues(nodeId, values)));
                    removed.addAll(diffSet.Removed);
                }
            }
            return(new AddedWithValuesAndRemoved(indexOrder == IndexOrder.DESCENDING ? added.asReversed() : added, removed));
        }
Example #2
0
        public override bool AcceptNode(long reference, Value[] values)
        {
            // First filter on these values, which come from the index. Some values will be NO_VALUE, because some indexed values cannot be read back.
            // Those values will have to be read from the store using the propertyCursor and is done in one pass after this loop, if needed.
            int storeLookups = 0;

            if (values == null)
            {
                // values == null effectively means that all values are NO_VALUE so we certainly need the store lookup here
                foreach (IndexQuery filter in _filters)
                {
                    if (filter != null)
                    {
                        storeLookups++;
                    }
                }
            }
            else
            {
                for (int i = 0; i < _filters.Length; i++)
                {
                    IndexQuery filter = _filters[i];
                    if (filter != null)
                    {
                        if (values[i] == NO_VALUE)
                        {
                            storeLookups++;
                        }
                        else if (!filter.AcceptsValue(values[i]))
                        {
                            return(false);
                        }
                    }
                }
            }

            // If there were one or more NO_VALUE values above then open store cursor and read those values from the store,
            // applying the same filtering as above, but with a loop designed to do only a single pass over the store values,
            // because it's the most expensive part.
            if (storeLookups > 0 && !AcceptByStoreFiltering(reference, storeLookups, values))
            {
                return(false);
            }
            return(_target.acceptNode(reference, values));
        }