Skip to content

Commit

Permalink
Removed the experimental-vector-search feature
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Apr 17, 2024
1 parent a4e50c9 commit 0e044b1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 0 additions & 8 deletions src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ pub enum Selectors<T> {
All,
}

#[cfg(feature = "experimental-vector-search")]
#[derive(Debug, Serialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct HybridSearch<'a> {
Expand Down Expand Up @@ -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<HybridSearch<'a>>,

/// 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]>,
}
Expand Down Expand Up @@ -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,
}
}
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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};
Expand Down
17 changes: 6 additions & 11 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -69,7 +69,6 @@ pub struct HuggingFaceEmbedderSettings {
pub document_template: Option<String>,
}

#[cfg(feature = "experimental-vector-search")]
#[derive(Serialize, Deserialize, Default, Debug, Clone, Eq, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct OpenapiEmbedderSettings {
Expand All @@ -93,7 +92,6 @@ pub struct OpenapiEmbedderSettings {
pub document_template: Option<String>,
}

#[cfg(feature = "experimental-vector-search")]
#[derive(Serialize, Deserialize, Default, Debug, Clone, Eq, PartialEq, Copy)]
pub struct UserProvidedEmbedderSettings {
/// dimensions of your custom embedding
Expand Down Expand Up @@ -168,7 +166,6 @@ pub struct Settings {
#[serde(skip_serializing_if = "Option::is_none")]
pub proximity_precision: Option<String>,
/// 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<HashMap<String, Embedder>>,
}
Expand Down Expand Up @@ -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<S>(self, embedders: HashMap<S, Embedder>) -> Settings
where
S: AsRef<str>,
Expand Down Expand Up @@ -840,6 +838,7 @@ impl<Http: HttpClient> Index<Http> {
.await
}

/// EXPERIMENTAL
/// Get [embedders](https://www.meilisearch.com/docs/learn/experimental/vector_search) of the [Index].
///
/// ```
Expand Down Expand Up @@ -868,7 +867,6 @@ impl<Http: HttpClient> Index<Http> {
/// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
/// # });
/// ```
#[cfg(feature = "experimental-vector-search")]
pub async fn get_embedders(&self) -> Result<HashMap<String, Embedder>, Error> {
self.client
.http_client
Expand Down Expand Up @@ -1940,6 +1938,7 @@ impl<Http: HttpClient> Index<Http> {
.await
}

/// EXPERIMENTAL
/// Reset [embedders](https://www.meilisearch.com/docs/learn/experimental/vector_search) of the [Index].
///
/// # Example
Expand All @@ -1959,7 +1958,6 @@ impl<Http: HttpClient> Index<Http> {
/// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
/// # });
/// ```
#[cfg(feature = "experimental-vector-search")]
pub async fn reset_embedders(&self) -> Result<TaskInfo, Error> {
self.client
.http_client
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0e044b1

Please sign in to comment.