return OIndexReuseType.NO_INDEX;
}
@Override
public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) {
final OIndexDefinition indexDefinition = index.getDefinition();
OIndexCursor cursor;
final OIndexInternal<?> internalIndex = index.getInternal();
if (!internalIndex.canBeUsedInEqualityOperators())
return null;
if (indexDefinition.getParamCount() == 1) {
final Object key;
if (indexDefinition instanceof OIndexDefinitionMultiValue)
key = ((OIndexDefinitionMultiValue) indexDefinition).createSingleValue(keyParams.get(0));
else
key = indexDefinition.createValue(keyParams);
if (key == null)
return null;
final Object indexResult;
indexResult = index.get(key);
if (indexResult == null || indexResult instanceof OIdentifiable)
cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, key);
else
cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult).iterator(), key);
} else {
// in case of composite keys several items can be returned in case of we perform search
// using part of composite key stored in index.
final OCompositeIndexDefinition compositeIndexDefinition = (OCompositeIndexDefinition) indexDefinition;
final Object keyOne = compositeIndexDefinition.createSingleValue(keyParams);
if (keyOne == null)
return null;
final Object keyTwo = compositeIndexDefinition.createSingleValue(keyParams);
if (internalIndex.hasRangeQuerySupport()) {
cursor = index.iterateEntriesBetween(keyOne, true, keyTwo, true, ascSortOrder);
} else {
int indexParamCount = indexDefinition.getParamCount();
if (indexParamCount == keyParams.size()) {
final Object indexResult;
indexResult = index.get(keyOne);
if (indexResult == null || indexResult instanceof OIdentifiable)