Skip to content

Commit 9d73cb9

Browse files
Add federation_options to SearchQuery
1 parent 5709e19 commit 9d73cb9

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
@@ -364,6 +364,16 @@ pub struct SearchQuery<'a, Http: HttpClient> {
364364

365365
#[serde(skip_serializing_if = "Option::is_none")]
366366
pub(crate) index_uid: Option<&'a str>,
367+
368+
#[serde(skip_serializing_if = "Option::is_none")]
369+
pub(crate) federation_options: Option<QueryFederationOptions>,
370+
}
371+
372+
#[derive(Debug, Serialize, Clone)]
373+
#[serde(rename_all = "camelCase")]
374+
pub struct QueryFederationOptions {
375+
#[serde(skip_serializing_if = "Option::is_none")]
376+
pub weight: Option<f32>,
367377
}
368378

369379
#[allow(missing_docs)]
@@ -396,6 +406,7 @@ impl<'a, Http: HttpClient> SearchQuery<'a, Http> {
396406
distinct: None,
397407
ranking_score_threshold: None,
398408
locales: None,
409+
federation_options: None,
399410
}
400411
}
401412
pub fn with_query<'b>(&'b mut self, query: &'a str) -> &'b mut SearchQuery<'a, Http> {
@@ -603,6 +614,14 @@ impl<'a, Http: HttpClient> SearchQuery<'a, Http> {
603614
self.locales = Some(locales);
604615
self
605616
}
617+
/// Only usable in federated multi search queries.
618+
pub fn with_federation_options<'b>(
619+
&'b mut self,
620+
federation_options: QueryFederationOptions,
621+
) -> &'b mut SearchQuery<'a, Http> {
622+
self.federation_options = Some(federation_options);
623+
self
624+
}
606625
pub fn build(&mut self) -> SearchQuery<'a, Http> {
607626
self.clone()
608627
}

0 commit comments

Comments
 (0)