final OIndexCursor entries = dictionary.getIndex().iterateEntriesMajor(startkey, true, true);
@Override public OIndexCursor iterateEntriesMajor(Object fromKey, boolean fromInclusive, boolean ascOrder) { return delegate.iterateEntriesMajor(fromKey, fromInclusive, ascOrder); }
@Override public OIndexCursor iterateEntriesMajor(Object fromKey, boolean fromInclusive, boolean ascOrder) { final OIndexCursor internalCursor = lastIndex.iterateEntriesMajor(fromKey, fromInclusive, ascOrder); return new ExternalIndexCursor(internalCursor); }
private OIndexCursor createCursor(OBinaryCompareOperator operator, OIndexDefinition definition, Object value, OCommandContext ctx) { boolean orderAsc = isOrderAsc(); if (operator instanceof OEqualsCompareOperator) { return index.iterateEntries(toIndexKey(definition, value), orderAsc); } else if (operator instanceof OGeOperator) { return index.iterateEntriesMajor(value, true, orderAsc); } else if (operator instanceof OGtOperator) { return index.iterateEntriesMajor(value, false, orderAsc); } else if (operator instanceof OLeOperator) { return index.iterateEntriesMinor(value, true, orderAsc); } else if (operator instanceof OLtOperator) { return index.iterateEntriesMinor(value, false, orderAsc); } else { throw new OCommandExecutionException("search for index for " + condition + " is not supported yet"); } }
private OIndexCursor createCursor(OBinaryCompareOperator operator, OIndexDefinition definition, Object value, OCommandContext ctx) { boolean orderAsc = isOrderAsc(); if (operator instanceof OEqualsCompareOperator || operator instanceof OContainsKeyOperator || operator instanceof OContainsValueOperator) { return index.iterateEntries(toIndexKey(definition, value), orderAsc); } else if (operator instanceof OGeOperator) { return index.iterateEntriesMajor(value, true, orderAsc); } else if (operator instanceof OGtOperator) { return index.iterateEntriesMajor(value, false, orderAsc); } else if (operator instanceof OLeOperator) { return index.iterateEntriesMinor(value, true, orderAsc); } else if (operator instanceof OLtOperator) { return index.iterateEntriesMinor(value, false, orderAsc); } else { throw new OCommandExecutionException("search for index for " + condition + " is not supported yet"); } }
@Override public List<Object> edgeLookup(String edgeLabel, String indexPostfix, Object key) { OrientBaseGraph orientBaseGraph = unwrapCurrentGraph(); List<Object> ids = new ArrayList<>(); // Load the edge type in order to access the indices of the edge OrientEdgeType edgeType = orientBaseGraph.getEdgeType(edgeLabel); if (edgeType != null) { // Fetch the required index OIndex<?> index = edgeType.getClassIndex("e." + edgeLabel.toLowerCase() + "_" + indexPostfix); if (index != null) { // Iterate over the sb-tree index entries OIndexCursor cursor = index.iterateEntriesMajor(new OCompositeKey(key), true, false); while (cursor.hasNext()) { Entry<Object, OIdentifiable> entry = cursor.nextEntry(); if (entry != null) { OCompositeKey entryKey = (OCompositeKey) entry.getKey(); // The index returns all entries. We thus need to filter it manually if (entryKey.getKeys().get(1).equals(key)) { Object inId = entryKey.getKeys().get(0); // Only add the inbound vertex id to the list of ids ids.add(inId); } } else { break; } } } } return ids; }
return null; cursor = index.iterateEntriesMajor(key, true, ascSortOrder); } else {
return null; cursor = index.iterateEntriesMajor(key, false, ascSortOrder); } else {
cursor = index.iterateEntriesMajor(key, true, true); } else { cursor = index.iterateEntriesMinor(key, true, false);
final Object value = compiledFilter.getRootCondition().getRight(); final OIndexCursor cursor = index.iterateEntriesMajor(getIndexKey(index.getDefinition(), value, context), false, ascOrder); fetchEntriesFromIndexCursor(cursor); } else if (indexOperator instanceof OQueryOperatorMajorEquals) { final Object value = compiledFilter.getRootCondition().getRight(); final OIndexCursor cursor = index.iterateEntriesMajor(getIndexKey(index.getDefinition(), value, context), true, ascOrder); fetchEntriesFromIndexCursor(cursor);