Skip to content

Commit 67c4c36

Browse files
Add federation_options to SearchQuery
1 parent 8fa01e7 commit 67c4c36

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/search.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,16 @@ pub struct SearchQuery<'a, Http: HttpClient> {
349349

350350
#[serde(skip_serializing_if = "Option::is_none")]
351351
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>,
352362
}
353363

354364
#[allow(missing_docs)]
@@ -380,6 +390,7 @@ impl<'a, Http: HttpClient> SearchQuery<'a, Http> {
380390
index_uid: None,
381391
distinct: None,
382392
ranking_score_threshold: None,
393+
federation_options: None,
383394
}
384395
}
385396
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> {
583594
self.ranking_score_threshold = Some(ranking_score_threshold);
584595
self
585596
}
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+
}
586605
pub fn build(&mut self) -> SearchQuery<'a, Http> {
587606
self.clone()
588607
}

0 commit comments

Comments
 (0)