File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
Tests/Nest.Tests.Unit/Search/Rescoring Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -16,13 +16,17 @@ public interface IRescoreQuery
1616
1717 [ JsonProperty ( "rescore_query_weight" ) ]
1818 double ? RescoreQueryWeight { get ; set ; }
19+
20+ [ JsonProperty ( "score_mode" ) ]
21+ ScoreMode ? ScoreMode { get ; set ; }
1922 }
2023
2124 public class RescoreQuery : IRescoreQuery
2225 {
2326 public IQueryContainer Query { get ; set ; }
2427 public double ? QueryWeight { get ; set ; }
2528 public double ? RescoreQueryWeight { get ; set ; }
29+ public ScoreMode ? ScoreMode { get ; set ; }
2630 }
2731
2832 public class RescoreQueryDescriptor < T > : IRescoreQuery where T : class
@@ -35,6 +39,8 @@ public class RescoreQueryDescriptor<T> : IRescoreQuery where T : class
3539
3640 double ? IRescoreQuery . RescoreQueryWeight { get ; set ; }
3741
42+ ScoreMode ? IRescoreQuery . ScoreMode { get ; set ; }
43+
3844 public virtual RescoreQueryDescriptor < T > QueryWeight ( double queryWeight )
3945 {
4046 Self . QueryWeight = queryWeight ;
@@ -47,6 +53,12 @@ public virtual RescoreQueryDescriptor<T> RescoreQueryWeight(double rescoreQueryW
4753 return this ;
4854 }
4955
56+ public virtual RescoreQueryDescriptor < T > ScoreMode ( ScoreMode scoreMode )
57+ {
58+ Self . ScoreMode = scoreMode ;
59+ return this ;
60+ }
61+
5062 public virtual RescoreQueryDescriptor < T > Query ( Func < QueryDescriptor < T > , QueryContainer > query )
5163 {
5264 query . ThrowIfNull ( "query" ) ;
Original file line number Diff line number Diff line change 1212 }
1313 },
1414 "query_weight" : 1.0 ,
15- "rescore_query_weight" : 2.0
15+ "rescore_query_weight" : 2.0 ,
16+ "score_mode" : " multiply"
1617 }
1718 },
1819 "query" : {
19- "match_all" : {}
20+ "match_all" : { }
2021 },
21- }
22+ }
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ public void RescoreSerializes()
2929 . RescoreQuery ( rq=> rq
3030 . QueryWeight ( 1.0 )
3131 . RescoreQueryWeight ( 2.0 )
32+ . ScoreMode ( ScoreMode . Multiply )
3233 . Query ( q=> q . Term ( p=> p . Name , "nest" ) )
3334 )
3435 ) ;
You can’t perform that action at this time.
0 commit comments