From a5080ac6a64aac1d519303f89fdc987897e91959 Mon Sep 17 00:00:00 2001 From: Peter Fern Date: Thu, 15 Jan 2015 20:07:53 +1100 Subject: [PATCH] Handle numeric fields other than float64 in processProperty Assert non-float types to type float64, then re-process. Fixes #106 --- mapping_document.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mapping_document.go b/mapping_document.go index 604c1eb5..8036d4e6 100644 --- a/mapping_document.go +++ b/mapping_document.go @@ -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