private void buildDocument(Document document, Serializer serializer) {
final List<IndexableField> docFields = document.getFields();
serializer.fields( docFields );
for ( IndexableField fieldable : docFields ) {
final FieldType fieldType = (FieldType) fieldable.fieldType();
final NumericType numericType = fieldType.numericType();
if ( numericType != null ) {
LuceneNumericFieldContext context = new LuceneNumericFieldContext( fieldType, fieldable.name(), fieldable.boost() );
switch ( numericType ) {
case INT:
serializer.addIntNumericField( fieldable.numericValue().intValue(), context );
break;
case LONG:
serializer.addLongNumericField( fieldable.numericValue().longValue(), context );
break;
case FLOAT:
serializer.addFloatNumericField( fieldable.numericValue().floatValue(), context );
break;
case DOUBLE:
serializer.addDoubleNumericField( fieldable.numericValue().doubleValue(), context );
break;
default:
String dataType = numericType.toString();
throw log.unknownNumericFieldType( dataType );
}
}
else if (fieldable instanceof Field) {
Field safeField = (Field) fieldable;