@@ -25,7 +25,7 @@ public class RankFeatureQuery : FieldNameQueryBase, IRankFeatureQuery
2525 {
2626 protected override bool Conditionless => IsConditionless ( this ) ;
2727
28- internal static bool IsConditionless ( IRankFeatureQuery q ) => q . Field . IsConditionless ( ) || q . Function == null ;
28+ internal static bool IsConditionless ( IRankFeatureQuery q ) => q . Field . IsConditionless ( ) ;
2929
3030 internal override void InternalWrapInContainer ( IQueryContainer container ) => container . RankFeature = this ;
3131
@@ -189,18 +189,22 @@ public void Serialize(ref JsonWriter writer, IRankFeatureQuery value, IJsonForma
189189 writer . WritePropertyName ( "field" ) ;
190190 var fieldFormatter = formatterResolver . GetFormatter < Field > ( ) ;
191191 fieldFormatter . Serialize ( ref writer , value . Field , formatterResolver ) ;
192- writer . WriteValueSeparator ( ) ;
193- switch ( value . Function )
192+
193+ if ( value . Function != null )
194194 {
195- case IRankFeatureSigmoidFunction sigmoid :
196- SerializeScoreFunction ( ref writer , "sigmoid" , sigmoid , formatterResolver ) ;
197- break ;
198- case IRankFeatureSaturationFunction saturation :
199- SerializeScoreFunction ( ref writer , "saturation" , saturation , formatterResolver ) ;
200- break ;
201- case IRankFeatureLogarithmFunction log :
202- SerializeScoreFunction ( ref writer , "log" , log , formatterResolver ) ;
203- break ;
195+ writer . WriteValueSeparator ( ) ;
196+ switch ( value . Function )
197+ {
198+ case IRankFeatureSigmoidFunction sigmoid :
199+ SerializeScoreFunction ( ref writer , "sigmoid" , sigmoid , formatterResolver ) ;
200+ break ;
201+ case IRankFeatureSaturationFunction saturation :
202+ SerializeScoreFunction ( ref writer , "saturation" , saturation , formatterResolver ) ;
203+ break ;
204+ case IRankFeatureLogarithmFunction log :
205+ SerializeScoreFunction ( ref writer , "log" , log , formatterResolver ) ;
206+ break ;
207+ }
204208 }
205209
206210 writer . WriteEndObject ( ) ;
0 commit comments