0
0

Handle numeric fields other than float64 in processProperty

Assert non-float types to type float64, then re-process.

Fixes #106
This commit is contained in:
Peter Fern 2015-01-15 20:07:53 +11:00
parent 530613a239
commit a5080ac6a6

View File

@ -294,7 +294,13 @@ func (dm *DocumentMapping) processProperty(property interface{}, path []string,
}
}
}
case reflect.Float64:
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
dm.processProperty(float64(propertyValue.Int()), path, indexes, context)
return
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
dm.processProperty(float64(propertyValue.Uint()), path, indexes, context)
return
case reflect.Float64, reflect.Float32:
propertyValFloat := propertyValue.Float()
if subDocMapping != nil {
// index by explicit mapping