@@ -349,6 +349,16 @@ pub struct SearchQuery<'a, Http: HttpClient> {
349
349
350
350
#[ serde( skip_serializing_if = "Option::is_none" ) ]
351
351
pub ( crate ) index_uid : Option < & ' a str > ,
352
+
353
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
354
+ pub ( crate ) federation_options : Option < QueryFederationOptions > ,
355
+ }
356
+
357
+ #[ derive( Debug , Serialize , Clone ) ]
358
+ #[ serde( rename_all = "camelCase" ) ]
359
+ pub struct QueryFederationOptions {
360
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
361
+ pub weight : Option < f32 > ,
352
362
}
353
363
354
364
#[ allow( missing_docs) ]
@@ -380,6 +390,7 @@ impl<'a, Http: HttpClient> SearchQuery<'a, Http> {
380
390
index_uid : None ,
381
391
distinct : None ,
382
392
ranking_score_threshold : None ,
393
+ federation_options : None ,
383
394
}
384
395
}
385
396
pub fn with_query < ' b > ( & ' b mut self , query : & ' a str ) -> & ' b mut SearchQuery < ' a , Http > {
@@ -583,6 +594,14 @@ impl<'a, Http: HttpClient> SearchQuery<'a, Http> {
583
594
self . ranking_score_threshold = Some ( ranking_score_threshold) ;
584
595
self
585
596
}
597
+ /// Only usable in federated multi search queries.
598
+ pub fn with_federation_options < ' b > (
599
+ & ' b mut self ,
600
+ federation_options : QueryFederationOptions ,
601
+ ) -> & ' b mut SearchQuery < ' a , Http > {
602
+ self . federation_options = Some ( federation_options) ;
603
+ self
604
+ }
586
605
pub fn build ( & mut self ) -> SearchQuery < ' a , Http > {
587
606
self . clone ( )
588
607
}
0 commit comments