@@ -134,8 +134,11 @@ private bool WriteNumericDecay(JsonWriter writer, IDecayFunction<double?, double
134134 private bool WriteDateDecay ( JsonWriter writer , IDecayFunction < DateMath , Time > value , JsonSerializer serializer )
135135 {
136136 if ( value == null || value . Field . IsConditionless ( ) ) return false ;
137- writer . WritePropertyName ( "origin" ) ;
138- serializer . Serialize ( writer , value . Origin ) ;
137+ if ( value . Origin != null )
138+ {
139+ writer . WritePropertyName ( "origin" ) ;
140+ serializer . Serialize ( writer , value . Origin ) ;
141+ }
139142 writer . WritePropertyName ( "scale" ) ;
140143 serializer . Serialize ( writer , value . Scale ) ;
141144 if ( value . Offset != null )
@@ -166,11 +169,11 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
166169 {
167170 var jo = JObject . Load ( reader ) ;
168171 QueryContainer filter = jo . Property ( "filter" ) ? . Value . ToObject < QueryContainer > ( serializer ) ;
169- double ? weight = jo . Property ( "weight" ) ? . Value . ToObject < double ? > ( ) ; ;
172+ double ? weight = jo . Property ( "weight" ) ? . Value . ToObject < double ? > ( ) ; ;
170173 IScoreFunction function = null ;
171174 foreach ( var prop in jo . Properties ( ) )
172175 {
173- switch ( prop . Name )
176+ switch ( prop . Name )
174177 {
175178 case "exp" :
176179 case "gauss" :
@@ -222,7 +225,7 @@ private IDecayFunction ReadDecayFunction(string type, JObject o, JsonSerializer
222225 var origin = o . Property ( "origin" ) ? . Value . Type ;
223226 if ( origin == null ) return null ;
224227 var subType = "numeric" ;
225- switch ( origin )
228+ switch ( origin )
226229 {
227230 case JTokenType . String :
228231 subType = "date" ;
0 commit comments