mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-30 23:27:36 +01:00
Add new experimental feature
This commit is contained in:
parent
42257eec53
commit
3998a850f7
@ -86,6 +86,19 @@ impl RoFeatures {
|
||||
.into())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check_proxy_search(&self, disabled_action: &'static str) -> Result<()> {
|
||||
if self.runtime.proxy_search {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(FeatureNotEnabledError {
|
||||
disabled_action,
|
||||
feature: "proxy search",
|
||||
issue_link: "https://github.com/orgs/meilisearch/discussions/805",
|
||||
}
|
||||
.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FeatureData {
|
||||
|
@ -7,6 +7,7 @@ pub struct RuntimeTogglableFeatures {
|
||||
pub logs_route: bool,
|
||||
pub edit_documents_by_function: bool,
|
||||
pub contains_filter: bool,
|
||||
pub proxy_search: bool,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, Copy)]
|
||||
|
@ -195,6 +195,7 @@ struct Infos {
|
||||
experimental_reduce_indexing_memory_usage: bool,
|
||||
experimental_max_number_of_batched_tasks: usize,
|
||||
experimental_limit_batched_tasks_total_size: u64,
|
||||
experimental_proxy_search: bool,
|
||||
gpu_enabled: bool,
|
||||
db_path: bool,
|
||||
import_dump: bool,
|
||||
@ -285,6 +286,7 @@ impl Infos {
|
||||
logs_route,
|
||||
edit_documents_by_function,
|
||||
contains_filter,
|
||||
proxy_search,
|
||||
} = features;
|
||||
|
||||
// We're going to override every sensible information.
|
||||
@ -302,6 +304,7 @@ impl Infos {
|
||||
experimental_replication_parameters,
|
||||
experimental_enable_logs_route: experimental_enable_logs_route | logs_route,
|
||||
experimental_reduce_indexing_memory_usage,
|
||||
experimental_proxy_search: proxy_search,
|
||||
gpu_enabled: meilisearch_types::milli::vector::is_cuda_enabled(),
|
||||
db_path: db_path != PathBuf::from("./data.ms"),
|
||||
import_dump: import_dump.is_some(),
|
||||
|
@ -50,6 +50,7 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
||||
logs_route: Some(false),
|
||||
edit_documents_by_function: Some(false),
|
||||
contains_filter: Some(false),
|
||||
proxy_search: Some(false),
|
||||
})),
|
||||
(status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!(
|
||||
{
|
||||
@ -88,6 +89,8 @@ pub struct RuntimeTogglableFeatures {
|
||||
pub edit_documents_by_function: Option<bool>,
|
||||
#[deserr(default)]
|
||||
pub contains_filter: Option<bool>,
|
||||
#[deserr(default)]
|
||||
pub proxy_search: Option<bool>,
|
||||
}
|
||||
|
||||
impl From<meilisearch_types::features::RuntimeTogglableFeatures> for RuntimeTogglableFeatures {
|
||||
@ -97,6 +100,7 @@ impl From<meilisearch_types::features::RuntimeTogglableFeatures> for RuntimeTogg
|
||||
logs_route,
|
||||
edit_documents_by_function,
|
||||
contains_filter,
|
||||
proxy_search,
|
||||
} = value;
|
||||
|
||||
Self {
|
||||
@ -104,6 +108,7 @@ impl From<meilisearch_types::features::RuntimeTogglableFeatures> for RuntimeTogg
|
||||
logs_route: Some(logs_route),
|
||||
edit_documents_by_function: Some(edit_documents_by_function),
|
||||
contains_filter: Some(contains_filter),
|
||||
proxy_search: Some(proxy_search),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -114,6 +119,7 @@ pub struct PatchExperimentalFeatureAnalytics {
|
||||
logs_route: bool,
|
||||
edit_documents_by_function: bool,
|
||||
contains_filter: bool,
|
||||
proxy_search: bool,
|
||||
}
|
||||
|
||||
impl Aggregate for PatchExperimentalFeatureAnalytics {
|
||||
@ -127,6 +133,7 @@ impl Aggregate for PatchExperimentalFeatureAnalytics {
|
||||
logs_route: new.logs_route,
|
||||
edit_documents_by_function: new.edit_documents_by_function,
|
||||
contains_filter: new.contains_filter,
|
||||
proxy_search: new.proxy_search,
|
||||
})
|
||||
}
|
||||
|
||||
@ -149,6 +156,7 @@ impl Aggregate for PatchExperimentalFeatureAnalytics {
|
||||
logs_route: Some(false),
|
||||
edit_documents_by_function: Some(false),
|
||||
contains_filter: Some(false),
|
||||
proxy_search: Some(false),
|
||||
})),
|
||||
(status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!(
|
||||
{
|
||||
@ -181,6 +189,7 @@ async fn patch_features(
|
||||
.edit_documents_by_function
|
||||
.unwrap_or(old_features.edit_documents_by_function),
|
||||
contains_filter: new_features.0.contains_filter.unwrap_or(old_features.contains_filter),
|
||||
proxy_search: new_features.0.proxy_search.unwrap_or(old_features.proxy_search),
|
||||
};
|
||||
|
||||
// explicitly destructure for analytics rather than using the `Serialize` implementation, because
|
||||
@ -191,6 +200,7 @@ async fn patch_features(
|
||||
logs_route,
|
||||
edit_documents_by_function,
|
||||
contains_filter,
|
||||
proxy_search,
|
||||
} = new_features;
|
||||
|
||||
analytics.publish(
|
||||
@ -199,6 +209,7 @@ async fn patch_features(
|
||||
logs_route,
|
||||
edit_documents_by_function,
|
||||
contains_filter,
|
||||
proxy_search,
|
||||
},
|
||||
&req,
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user