4
4
5
5
using System . Diagnostics ;
6
6
using Nest . Utf8Json ;
7
+ using System . Runtime . Serialization ;
7
8
8
9
namespace Nest
9
10
{
@@ -15,20 +16,37 @@ namespace Nest
15
16
[ InterfaceDataContract ]
16
17
public interface IRankFeaturesProperty : IProperty
17
18
{
19
+ /// <summary>
20
+ /// Rank features that correlate negatively with the score should set <see cref="PositiveScoreImpact"/>
21
+ /// to false (defaults to true). This will be used by the rank_features query to modify the scoring
22
+ /// formula in such a way that the score decreases with the value of the feature instead of
23
+ /// increasing.
24
+ /// </summary>
25
+ [ DataMember ( Name = "positive_score_impact" ) ]
26
+ bool ? PositiveScoreImpact { get ; set ; }
18
27
}
19
28
20
29
/// <inheritdoc cref="IRankFeaturesProperty" />
21
30
public class RankFeaturesProperty : PropertyBase , IRankFeaturesProperty
22
31
{
23
32
public RankFeaturesProperty ( ) : base ( FieldType . RankFeatures ) { }
33
+
34
+ /// <inheritdoc />
35
+ public bool ? PositiveScoreImpact { get ; set ; }
24
36
}
25
37
26
38
/// <inheritdoc cref="IRankFeaturesProperty" />
27
- [ DebuggerDisplay ( "{DebugDisplay}" ) ]
39
+ [ DebuggerDisplay ( "{" + nameof ( DebugDisplay ) + " }") ]
28
40
public class RankFeaturesPropertyDescriptor < T >
29
41
: PropertyDescriptorBase < RankFeaturesPropertyDescriptor < T > , IRankFeaturesProperty , T > , IRankFeaturesProperty
30
42
where T : class
31
43
{
32
44
public RankFeaturesPropertyDescriptor ( ) : base ( FieldType . RankFeatures ) { }
45
+
46
+ bool ? IRankFeaturesProperty . PositiveScoreImpact { get ; set ; }
47
+
48
+ /// <inheritdoc cref="IRankFeaturesProperty.PositiveScoreImpact" />
49
+ public RankFeaturesPropertyDescriptor < T > PositiveScoreImpact ( bool ? positiveScoreImpact = true ) =>
50
+ Assign ( positiveScoreImpact , ( a , v ) => a . PositiveScoreImpact = v ) ;
33
51
}
34
52
}
0 commit comments