public override long CountIndexedNodes(long nodeId, int[] propertyKeyIds, params Value[] propertyValues) { KEY treeKeyFrom = Layout.newKey(); KEY treeKeyTo = Layout.newKey(); treeKeyFrom.initialize(nodeId); treeKeyTo.initialize(nodeId); for (int i = 0; i < propertyValues.Length; i++) { treeKeyFrom.initFromValue(i, propertyValues[i], NEUTRAL); treeKeyTo.initFromValue(i, propertyValues[i], NEUTRAL); } try { using (RawCursor <Hit <KEY, VALUE>, IOException> seeker = Tree.seek(treeKeyFrom, treeKeyTo)) { long count = 0; while (seeker.Next()) { if (seeker.get().key().EntityId == nodeId) { count++; } } return(count); } } catch (IOException e) { throw new UncheckedIOException(e); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.neo4j.cursor.RawCursor<org.neo4j.index.internal.gbptree.Hit<LabelScanKey,LabelScanValue>,java.io.IOException> seekerForLabel(long startId, int labelId) throws java.io.IOException private RawCursor <Hit <LabelScanKey, LabelScanValue>, IOException> SeekerForLabel(long startId, int labelId) { LabelScanKey from = new LabelScanKey(labelId, rangeOf(startId)); LabelScanKey to = new LabelScanKey(labelId, long.MaxValue); return(_index.seek(from, to)); }
public override IndexSample Result() { KEY lowest = _layout.newKey(); lowest.initialize(long.MinValue); lowest.initValuesAsLowest(); KEY highest = _layout.newKey(); highest.initialize(long.MaxValue); highest.initValuesAsHighest(); KEY prev = _layout.newKey(); try { using (RawCursor <Hit <KEY, VALUE>, IOException> seek = _gbpTree.seek(lowest, highest)) { long sampledValues = 0; long uniqueValues = 0; // Get the first one so that prev gets initialized if (seek.Next()) { prev = _layout.copyKey(seek.get().key(), prev); sampledValues++; uniqueValues++; // Then do the rest while (seek.Next()) { Hit <KEY, VALUE> hit = seek.get(); if (_layout.compareValue(prev, hit.Key()) != 0) { uniqueValues++; _layout.copyKey(hit.Key(), prev); } // else this is a duplicate of the previous one sampledValues++; } } return(new IndexSample(sampledValues, uniqueValues, sampledValues)); } } catch (IOException e) { throw new UncheckedIOException(e); } }
public override IEnumerator <long> Iterator() { KEY from = _layout.newKey(); from.initialize(long.MinValue); from.initValuesAsLowest(); KEY to = _layout.newKey(); to.initialize(long.MaxValue); to.initValuesAsHighest(); try { CloseSeeker(); _seeker = _tree.seek(from, to); return(new PrefetchingIteratorAnonymousInnerClass(this)); } catch (IOException e) { throw new UncheckedIOException(e); } }