File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ public interface IHit<out T> where T : class
1212 IFieldSelection < T > Fields { get ; }
1313 T Source { get ; }
1414 string Index { get ; }
15- double ? Score { get ; }
15+ double Score { get ; }
1616 string Type { get ; }
1717 string Version { get ; }
1818 string Id { get ; }
@@ -35,8 +35,12 @@ public class Hit<T> : IHit<T>
3535 public T Source { get ; internal set ; }
3636 [ JsonProperty ( PropertyName = "_index" ) ]
3737 public string Index { get ; internal set ; }
38+
39+ //TODO in NEST 2.0 make the property itself double?
3840 [ JsonProperty ( PropertyName = "_score" ) ]
39- public double ? Score { get ; internal set ; }
41+ internal double ? _score { get ; set ; }
42+ public double Score { get { return _score . GetValueOrDefault ( 0 ) ; } }
43+
4044 [ JsonProperty ( PropertyName = "_type" ) ]
4145 public string Type { get ; internal set ; }
4246 [ JsonProperty ( PropertyName = "_version" ) ]
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ internal static Type GetConcreteTypeUsingSelector<T>(
175175 hitDynamic . Fields = sel ;
176176 hitDynamic . Source = d . _source ;
177177 hitDynamic . Index = d . _index ;
178- hitDynamic . Score = ( d . _score is double ) ? d . _score : default ( double ) ;
178+ hitDynamic . _score = ( d . _score is double ) ? d . _score : default ( double ) ;
179179 hitDynamic . Type = d . _type ;
180180 hitDynamic . Version = d . _version ;
181181 hitDynamic . Id = d . _id ;
You can’t perform that action at this time.
0 commit comments