Skip to content

Commit a5f8e45

Browse files
committed
Improve API
1 parent fdaef5a commit a5f8e45

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/search.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -700,15 +700,6 @@ impl<'a, Http: HttpClient> SearchQuery<'a, Http> {
700700
self
701701
}
702702

703-
/// Only usable in federated multi search queries.
704-
pub fn with_federation_options<'b>(
705-
&'b mut self,
706-
federation_options: QueryFederationOptions,
707-
) -> &'b mut SearchQuery<'a, Http> {
708-
self.federation_options = Some(federation_options);
709-
self
710-
}
711-
712703
pub fn build(&mut self) -> SearchQuery<'a, Http> {
713704
self.clone()
714705
}
@@ -753,7 +744,18 @@ impl<'a, 'b, Http: HttpClient> MultiSearchQuery<'a, 'b, Http> {
753744
self
754745
}
755746

756-
/// Adds the `federation` parameter, making the search a federated search.
747+
pub fn with_search_query_and_options(
748+
&mut self,
749+
mut search_query: SearchQuery<'b, Http>,
750+
options: QueryFederationOptions,
751+
) -> &mut MultiSearchQuery<'a, 'b, Http> {
752+
search_query.with_index_uid();
753+
search_query.federation_options = Some(options);
754+
self.queries.push(search_query);
755+
self
756+
}
757+
758+
/// Adds the `federation` parameter, turning the search into a federated search.
757759
pub fn with_federation(
758760
self,
759761
federation: FederationOptions,

0 commit comments

Comments
 (0)