From 0e044b14c2937052e64ef12dfd46a34362a068d0 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Wed, 17 Apr 2024 15:44:30 +0200 Subject: [PATCH] Removed the `experimental-vector-search` feature --- Cargo.toml | 1 - src/search.rs | 8 -------- src/settings.rs | 17 ++++++----------- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 91a3c1d7..9ad71697 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,6 @@ wasm-bindgen-futures = "0.4" [features] default = ["reqwest"] reqwest = ["dep:reqwest", "pin-project-lite", "bytes"] -experimental-vector-search = [] [dev-dependencies] futures-await-test = "0.3" diff --git a/src/search.rs b/src/search.rs index 83d6e191..85706ce9 100644 --- a/src/search.rs +++ b/src/search.rs @@ -138,7 +138,6 @@ pub enum Selectors { All, } -#[cfg(feature = "experimental-vector-search")] #[derive(Debug, Serialize, Clone)] #[serde(rename_all = "camelCase")] pub struct HybridSearch<'a> { @@ -347,13 +346,11 @@ pub struct SearchQuery<'a, Http: HttpClient> { /// EXPERIMENTAL /// Defines whether to utilise previously defined embedders for semantic searching - #[cfg(feature = "experimental-vector-search")] #[serde(skip_serializing_if = "Option::is_none")] pub hybrid: Option>, /// EXPERIMENTAL /// Defines what vectors an userprovided embedder has gotten for semantic searching - #[cfg(feature = "experimental-vector-search")] #[serde(skip_serializing_if = "Option::is_none")] pub vector: Option<&'a [f32]>, } @@ -384,9 +381,7 @@ impl<'a, Http: HttpClient> SearchQuery<'a, Http> { show_ranking_score: None, matching_strategy: None, index_uid: None, - #[cfg(feature = "experimental-vector-search")] hybrid: None, - #[cfg(feature = "experimental-vector-search")] vector: None, } } @@ -573,7 +568,6 @@ impl<'a, Http: HttpClient> SearchQuery<'a, Http> { } /// EXPERIMENTAL /// Defines whether to utilise previously defined embedders for semantic searching - #[cfg(feature = "experimental-vector-search")] pub fn with_hybrid<'b>( &'b mut self, embedder: &'a str, @@ -587,7 +581,6 @@ impl<'a, Http: HttpClient> SearchQuery<'a, Http> { } /// EXPERIMENTAL /// Defines what vectors an userprovided embedder has gotten for semantic searching - #[cfg(feature = "experimental-vector-search")] pub fn with_vector<'b>(&'b mut self, vector: &'a [f32]) -> &'b mut SearchQuery<'a, Http> { self.vector = Some(vector); self @@ -1240,7 +1233,6 @@ mod tests { Ok(()) } - #[cfg(feature = "experimental-vector-search")] #[meilisearch_test] async fn test_hybrid(client: Client, index: Index) -> Result<(), Error> { use crate::settings::{Embedder, UserProvidedEmbedderSettings}; diff --git a/src/settings.rs b/src/settings.rs index 442391bc..e399db3e 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -36,7 +36,8 @@ pub struct FacetingSettings { pub max_values_per_facet: usize, } -#[cfg(feature = "experimental-vector-search")] +/// EXPERIMENTAL +/// Allows configuring semantic seaarching #[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)] #[serde(rename_all = "camelCase", tag = "source")] pub enum Embedder { @@ -50,7 +51,6 @@ pub enum Embedder { UserProvided(UserProvidedEmbedderSettings), } -#[cfg(feature = "experimental-vector-search")] #[derive(Serialize, Deserialize, Default, Debug, Clone, Eq, PartialEq)] #[serde(rename_all = "camelCase")] pub struct HuggingFaceEmbedderSettings { @@ -69,7 +69,6 @@ pub struct HuggingFaceEmbedderSettings { pub document_template: Option, } -#[cfg(feature = "experimental-vector-search")] #[derive(Serialize, Deserialize, Default, Debug, Clone, Eq, PartialEq)] #[serde(rename_all = "camelCase")] pub struct OpenapiEmbedderSettings { @@ -93,7 +92,6 @@ pub struct OpenapiEmbedderSettings { pub document_template: Option, } -#[cfg(feature = "experimental-vector-search")] #[derive(Serialize, Deserialize, Default, Debug, Clone, Eq, PartialEq, Copy)] pub struct UserProvidedEmbedderSettings { /// dimensions of your custom embedding @@ -168,7 +166,6 @@ pub struct Settings { #[serde(skip_serializing_if = "Option::is_none")] pub proximity_precision: Option, /// Settings how the embeddings for the experimental vector search feature are generated - #[cfg(feature = "experimental-vector-search")] #[serde(skip_serializing_if = "Option::is_none")] pub embedders: Option>, } @@ -355,8 +352,9 @@ impl Settings { } } + /// EXPERIMENTAL + /// Set the [embedders](https://www.meilisearch.com/docs/learn/experimental/vector_search) of the [Index]. #[must_use] - #[cfg(feature = "experimental-vector-search")] pub fn with_embedders(self, embedders: HashMap) -> Settings where S: AsRef, @@ -840,6 +838,7 @@ impl Index { .await } + /// EXPERIMENTAL /// Get [embedders](https://www.meilisearch.com/docs/learn/experimental/vector_search) of the [Index]. /// /// ``` @@ -868,7 +867,6 @@ impl Index { /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap(); /// # }); /// ``` - #[cfg(feature = "experimental-vector-search")] pub async fn get_embedders(&self) -> Result, Error> { self.client .http_client @@ -1940,6 +1938,7 @@ impl Index { .await } + /// EXPERIMENTAL /// Reset [embedders](https://www.meilisearch.com/docs/learn/experimental/vector_search) of the [Index]. /// /// # Example @@ -1959,7 +1958,6 @@ impl Index { /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap(); /// # }); /// ``` - #[cfg(feature = "experimental-vector-search")] pub async fn reset_embedders(&self) -> Result { self.client .http_client @@ -2008,7 +2006,6 @@ mod tests { assert_eq!(faceting, res); } - #[cfg(feature = "experimental-vector-search")] #[meilisearch_test] async fn test_get_embeddings(index: Index) { let res = index.get_embedders().await.unwrap(); @@ -2042,7 +2039,6 @@ mod tests { assert_eq!(faceting, res); } - #[cfg(feature = "experimental-vector-search")] #[meilisearch_test] async fn test_reset_embedders(client: Client, index: Index) { let features = crate::features::ExperimentalFeatures::new(&client) @@ -2235,7 +2231,6 @@ mod tests { assert_eq!(expected, res); } - #[cfg(feature = "experimental-vector-search")] #[meilisearch_test] async fn test_set_embedding_settings(client: Client, index: Index) { let features = crate::features::ExperimentalFeatures::new(&client)