private Object getFieldValue(Object value, String fieldName) {
    if (value instanceof PdxInstance) {
      PdxInstance pdx = (PdxInstance) value;
      Object fieldValue = null;
      if (pdx.hasField(fieldName)) {
        fieldValue = pdx.getField(fieldName);
      }
      return fieldValue;
    } else {
      Class<?> clazz = value.getClass();
      if (fieldName.equals(LuceneService.REGION_VALUE_FIELD)
          && SerializerUtil.supportedPrimitiveTypes().contains(clazz)) {
        return value;
      }

      do {
        try {
          Field field = clazz.getDeclaredField(fieldName);
          field.setAccessible(true);
          return field.get(value);
        } catch (Exception e) {
          clazz = clazz.getSuperclass();
        }
      } while (clazz != null && !clazz.equals(Object.class));
      return null;
    }
  }
Recursively serialize each indexed field's value into a field of lucene document. The field
name will be in the same format as its indexed, such as contacts.homepage.content

@param index lucene index
@param value user object to be serialized into index
geode-lucene/src/main/java/org/apache/geode/cache/lucene/FlatFormatSerializer.java