public static boolean addField(Document doc, String field, Object fieldValue) {
    Class<?> clazz = fieldValue.getClass();
    if (clazz == String.class) {
      doc.add(new TextField(field, (String) fieldValue, Store.NO));
    } else if (clazz == Long.class) {
      doc.add(new LongPoint(field, (Long) fieldValue));
    } else if (clazz == Integer.class) {
      doc.add(new IntPoint(field, (Integer) fieldValue));
    } else if (clazz == Float.class) {
      doc.add(new FloatPoint(field, (Float) fieldValue));
    } else if (clazz == Double.class) {
      doc.add(new DoublePoint(field, (Double) fieldValue));
    } else {
      return false;
    }

    return true;
  }
Add a field to the document.

@return true if the field was successfully added
geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/SerializerUtil.java