core/src/main/java/com/orientechnologies/orient/core/index/OIndexDefinitionFactory.java
public static String extractFieldName(final String fieldDefinition) {
    String[] fieldNameParts = FILED_NAME_PATTERN.split(fieldDefinition);
    if (fieldNameParts.length == 0) {
      throw new IllegalArgumentException(
          "Illegal field name format, should be '<property> [by key|value]' but was '" + fieldDefinition + '\'');
    }
    if (fieldNameParts.length == 3 && "by".equalsIgnoreCase(fieldNameParts[1]))
      return fieldNameParts[0];

    if (fieldNameParts.length == 1)
      return fieldDefinition;

    StringBuilder result = new StringBuilder();
    result.append(fieldNameParts[0]);
    for (int i = 1; i < fieldNameParts.length; i++) {
      result.append(" ");
      result.append(fieldNameParts[i]);
    }
    return result.toString();

  }
public static String extractFieldName(final String fieldDefinition) {
    String[] fieldNameParts = FILED_NAME_PATTERN.split(fieldDefinition);
    if (fieldNameParts.length == 0) {
      throw new IllegalArgumentException(
          "Illegal field name format, should be '<property> [by key|value]' but was '" + fieldDefinition + '\'');
    }
    if (fieldNameParts.length == 3 && "by".equalsIgnoreCase(fieldNameParts[1]))
      return fieldNameParts[0];

    if (fieldNameParts.length == 1)
      return fieldDefinition;

    StringBuilder result = new StringBuilder();
    result.append(fieldNameParts[0]);
    for (int i = 1; i < fieldNameParts.length; i++) {
      result.append(" ");
      result.append(fieldNameParts[i]);
    }
    return result.toString();

  }
Extract field name from '<property> [by key|value]' field format.

@param fieldDefinition definition of field

@return extracted property name