Skip to content

Commit a7d61e1

Browse files
committed
Renames
1 parent 972da7f commit a7d61e1

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/indexes.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1702,7 +1702,7 @@ impl<Http: HttpClient> Index<Http> {
17021702
/// # movies.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
17031703
/// # });
17041704
/// ```
1705-
pub async fn similar_query<T: 'static + DeserializeOwned + Send + Sync>(
1705+
pub async fn execute_similar_query<T: 'static + DeserializeOwned + Send + Sync>(
17061706
&self,
17071707
body: &SimilarQuery<'_, Http>,
17081708
) -> Result<SimilarResults<T>, Error> {
@@ -1715,6 +1715,14 @@ impl<Http: HttpClient> Index<Http> {
17151715
)
17161716
.await
17171717
}
1718+
1719+
pub fn similar_search<'a, T: 'static + DeserializeOwned + Send + Sync>(
1720+
&'a self,
1721+
document_id: &'a str,
1722+
index_name: &'a str,
1723+
) -> SimilarQuery<'a, Http> {
1724+
SimilarQuery::new(self, document_id, index_name)
1725+
}
17181726
}
17191727

17201728
impl<Http: HttpClient> AsRef<str> for Index<Http> {

src/similar.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub struct SimilarResults<T> {
4545
///
4646
/// ```no_run
4747
/// # use serde::{Serialize, Deserialize};
48-
/// # use meilisearch_sdk::{client::Client, search::*, indexes::Index, similar::SimilarQuery};
48+
/// # use meilisearch_sdk::{client::Client, search::*, indexes::Index};
4949
/// #
5050
/// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
5151
/// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
@@ -60,7 +60,7 @@ pub struct SimilarResults<T> {
6060
/// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
6161
/// # let index = client.index("similar_query_builder");
6262
/// #
63-
/// let mut res = SimilarQuery::new(&index, "100", "default")
63+
/// let mut res = index.similar_search("100", "default")
6464
/// .execute::<Movie>()
6565
/// .await
6666
/// .unwrap();
@@ -213,7 +213,7 @@ impl<'a, Http: HttpClient> SimilarQuery<'a, Http> {
213213
pub async fn execute<T: 'static + DeserializeOwned + Send + Sync>(
214214
&'a self,
215215
) -> Result<SimilarResults<T>, Error> {
216-
self.index.similar_query::<T>(self).await
216+
self.index.execute_similar_query::<T>(self).await
217217
}
218218
}
219219

0 commit comments

Comments
 (0)