core/src/main/java/com/orientechnologies/orient/core/sql/OFilterAnalyzer.java
private OIndexSearchResult createIndexedProperty(final OSQLFilterCondition iCondition, final Object iItem, OCommandContext ctx) {
    if (iItem == null || !(iItem instanceof OSQLFilterItemField)) {
      return null;
    }

    if (iCondition.getLeft() instanceof OSQLFilterItemField && iCondition.getRight() instanceof OSQLFilterItemField) {
      return null;
    }

    final OSQLFilterItemField item = (OSQLFilterItemField) iItem;

    if (item.hasChainOperators() && !item.isFieldChain()) {
      return null;
    }

    boolean inverted = iCondition.getRight() == iItem;
    final Object origValue = inverted ? iCondition.getLeft() : iCondition.getRight();

    OQueryOperator operator = iCondition.getOperator();

    if (inverted) {
      if (operator instanceof OQueryOperatorIn) {
        operator = new OQueryOperatorContains();
      } else if (operator instanceof OQueryOperatorContains) {
        operator = new OQueryOperatorIn();
      } else if (operator instanceof OQueryOperatorMajor) {
        operator = new OQueryOperatorMinor();
      } else if (operator instanceof OQueryOperatorMinor) {
        operator = new OQueryOperatorMajor();
      } else if (operator instanceof OQueryOperatorMajorEquals) {
        operator = new OQueryOperatorMinorEquals();
      } else if (operator instanceof OQueryOperatorMinorEquals) {
        operator = new OQueryOperatorMajorEquals();
      }
    }

    if (iCondition.getOperator() instanceof OQueryOperatorBetween || operator instanceof OQueryOperatorIn) {

      return new OIndexSearchResult(operator, item.getFieldChain(), origValue);
    }

    final Object value = OSQLHelper.getValue(origValue, null, ctx);
    return new OIndexSearchResult(operator, item.getFieldChain(), value);
  }
private OIndexSearchResult createIndexedProperty(final OSQLFilterCondition iCondition, final Object iItem, OCommandContext ctx) {
    if (iItem == null || !(iItem instanceof OSQLFilterItemField)) {
      return null;
    }

    if (iCondition.getLeft() instanceof OSQLFilterItemField && iCondition.getRight() instanceof OSQLFilterItemField) {
      return null;
    }

    final OSQLFilterItemField item = (OSQLFilterItemField) iItem;

    if (item.hasChainOperators() && !item.isFieldChain()) {
      return null;
    }

    boolean inverted = iCondition.getRight() == iItem;
    final Object origValue = inverted ? iCondition.getLeft() : iCondition.getRight();

    OQueryOperator operator = iCondition.getOperator();

    if (inverted) {
      if (operator instanceof OQueryOperatorIn) {
        operator = new OQueryOperatorContains();
      } else if (operator instanceof OQueryOperatorContains) {
        operator = new OQueryOperatorIn();
      } else if (operator instanceof OQueryOperatorMajor) {
        operator = new OQueryOperatorMinor();
      } else if (operator instanceof OQueryOperatorMinor) {
        operator = new OQueryOperatorMajor();
      } else if (operator instanceof OQueryOperatorMajorEquals) {
        operator = new OQueryOperatorMinorEquals();
      } else if (operator instanceof OQueryOperatorMinorEquals) {
        operator = new OQueryOperatorMajorEquals();
      }
    }

    if (iCondition.getOperator() instanceof OQueryOperatorBetween || operator instanceof OQueryOperatorIn) {

      return new OIndexSearchResult(operator, item.getFieldChain(), origValue);
    }

    final Object value = OSQLHelper.getValue(origValue, null, ctx);
    return new OIndexSearchResult(operator, item.getFieldChain(), value);
  }
Add SQL filter field to the search candidate list.

@param iCondition Condition item
@param iItem      Value to search

@return true if the property was indexed and found, otherwise false