mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 21:04:27 +01:00
rename the search_cutoff parameter to search_cutoff_ms
This commit is contained in:
parent
038c26c118
commit
6a0c399c2f
@ -277,7 +277,7 @@ pub(crate) mod test {
|
|||||||
}),
|
}),
|
||||||
pagination: Setting::NotSet,
|
pagination: Setting::NotSet,
|
||||||
embedders: Setting::NotSet,
|
embedders: Setting::NotSet,
|
||||||
search_cutoff: Setting::NotSet,
|
search_cutoff_ms: Setting::NotSet,
|
||||||
_kind: std::marker::PhantomData,
|
_kind: std::marker::PhantomData,
|
||||||
};
|
};
|
||||||
settings.check()
|
settings.check()
|
||||||
|
@ -379,7 +379,7 @@ impl<T> From<v5::Settings<T>> for v6::Settings<v6::Unchecked> {
|
|||||||
v5::Setting::NotSet => v6::Setting::NotSet,
|
v5::Setting::NotSet => v6::Setting::NotSet,
|
||||||
},
|
},
|
||||||
embedders: v6::Setting::NotSet,
|
embedders: v6::Setting::NotSet,
|
||||||
search_cutoff: v6::Setting::NotSet,
|
search_cutoff_ms: v6::Setting::NotSet,
|
||||||
_kind: std::marker::PhantomData,
|
_kind: std::marker::PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ pub struct Settings<T> {
|
|||||||
pub embedders: Setting<BTreeMap<String, Setting<milli::vector::settings::EmbeddingSettings>>>,
|
pub embedders: Setting<BTreeMap<String, Setting<milli::vector::settings::EmbeddingSettings>>>,
|
||||||
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
#[serde(default, skip_serializing_if = "Setting::is_not_set")]
|
||||||
#[deserr(default, error = DeserrJsonError<InvalidSettingsSearchCutoff>)]
|
#[deserr(default, error = DeserrJsonError<InvalidSettingsSearchCutoff>)]
|
||||||
pub search_cutoff: Setting<u64>,
|
pub search_cutoff_ms: Setting<u64>,
|
||||||
|
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
#[deserr(skip)]
|
#[deserr(skip)]
|
||||||
@ -230,7 +230,7 @@ impl Settings<Checked> {
|
|||||||
faceting: Setting::Reset,
|
faceting: Setting::Reset,
|
||||||
pagination: Setting::Reset,
|
pagination: Setting::Reset,
|
||||||
embedders: Setting::Reset,
|
embedders: Setting::Reset,
|
||||||
search_cutoff: Setting::Reset,
|
search_cutoff_ms: Setting::Reset,
|
||||||
_kind: PhantomData,
|
_kind: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ impl Settings<Checked> {
|
|||||||
faceting,
|
faceting,
|
||||||
pagination,
|
pagination,
|
||||||
embedders,
|
embedders,
|
||||||
search_cutoff,
|
search_cutoff_ms,
|
||||||
..
|
..
|
||||||
} = self;
|
} = self;
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ impl Settings<Checked> {
|
|||||||
faceting,
|
faceting,
|
||||||
pagination,
|
pagination,
|
||||||
embedders,
|
embedders,
|
||||||
search_cutoff,
|
search_cutoff_ms,
|
||||||
_kind: PhantomData,
|
_kind: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,7 +321,7 @@ impl Settings<Unchecked> {
|
|||||||
faceting: self.faceting,
|
faceting: self.faceting,
|
||||||
pagination: self.pagination,
|
pagination: self.pagination,
|
||||||
embedders: self.embedders,
|
embedders: self.embedders,
|
||||||
search_cutoff: self.search_cutoff,
|
search_cutoff_ms: self.search_cutoff_ms,
|
||||||
_kind: PhantomData,
|
_kind: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ pub fn apply_settings_to_builder(
|
|||||||
faceting,
|
faceting,
|
||||||
pagination,
|
pagination,
|
||||||
embedders,
|
embedders,
|
||||||
search_cutoff,
|
search_cutoff_ms,
|
||||||
_kind,
|
_kind,
|
||||||
} = settings;
|
} = settings;
|
||||||
|
|
||||||
@ -548,7 +548,7 @@ pub fn apply_settings_to_builder(
|
|||||||
Setting::NotSet => (),
|
Setting::NotSet => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
match search_cutoff {
|
match search_cutoff_ms {
|
||||||
Setting::Set(cutoff) => builder.set_search_cutoff(*cutoff),
|
Setting::Set(cutoff) => builder.set_search_cutoff(*cutoff),
|
||||||
Setting::Reset => builder.reset_search_cutoff(),
|
Setting::Reset => builder.reset_search_cutoff(),
|
||||||
Setting::NotSet => (),
|
Setting::NotSet => (),
|
||||||
@ -641,7 +641,7 @@ pub fn settings(
|
|||||||
.collect();
|
.collect();
|
||||||
let embedders = if embedders.is_empty() { Setting::NotSet } else { Setting::Set(embedders) };
|
let embedders = if embedders.is_empty() { Setting::NotSet } else { Setting::Set(embedders) };
|
||||||
|
|
||||||
let search_cutoff = index.search_cutoff(rtxn)?;
|
let search_cutoff_ms = index.search_cutoff(rtxn)?;
|
||||||
|
|
||||||
Ok(Settings {
|
Ok(Settings {
|
||||||
displayed_attributes: match displayed_attributes {
|
displayed_attributes: match displayed_attributes {
|
||||||
@ -669,7 +669,7 @@ pub fn settings(
|
|||||||
faceting: Setting::Set(faceting),
|
faceting: Setting::Set(faceting),
|
||||||
pagination: Setting::Set(pagination),
|
pagination: Setting::Set(pagination),
|
||||||
embedders,
|
embedders,
|
||||||
search_cutoff: match search_cutoff {
|
search_cutoff_ms: match search_cutoff_ms {
|
||||||
Some(cutoff) => Setting::Set(cutoff),
|
Some(cutoff) => Setting::Set(cutoff),
|
||||||
None => Setting::Reset,
|
None => Setting::Reset,
|
||||||
},
|
},
|
||||||
@ -823,7 +823,7 @@ pub(crate) mod test {
|
|||||||
faceting: Setting::NotSet,
|
faceting: Setting::NotSet,
|
||||||
pagination: Setting::NotSet,
|
pagination: Setting::NotSet,
|
||||||
embedders: Setting::NotSet,
|
embedders: Setting::NotSet,
|
||||||
search_cutoff: Setting::NotSet,
|
search_cutoff_ms: Setting::NotSet,
|
||||||
_kind: PhantomData::<Unchecked>,
|
_kind: PhantomData::<Unchecked>,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -850,7 +850,7 @@ pub(crate) mod test {
|
|||||||
faceting: Setting::NotSet,
|
faceting: Setting::NotSet,
|
||||||
pagination: Setting::NotSet,
|
pagination: Setting::NotSet,
|
||||||
embedders: Setting::NotSet,
|
embedders: Setting::NotSet,
|
||||||
search_cutoff: Setting::NotSet,
|
search_cutoff_ms: Setting::NotSet,
|
||||||
_kind: PhantomData::<Unchecked>,
|
_kind: PhantomData::<Unchecked>,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -626,19 +626,19 @@ fn embedder_analytics(
|
|||||||
}
|
}
|
||||||
|
|
||||||
make_setting_route!(
|
make_setting_route!(
|
||||||
"/search-cutoff",
|
"/search-cutoff-ms",
|
||||||
put,
|
put,
|
||||||
u64,
|
u64,
|
||||||
meilisearch_types::deserr::DeserrJsonError<
|
meilisearch_types::deserr::DeserrJsonError<
|
||||||
meilisearch_types::error::deserr_codes::InvalidSettingsSearchCutoff,
|
meilisearch_types::error::deserr_codes::InvalidSettingsSearchCutoff,
|
||||||
>,
|
>,
|
||||||
search_cutoff,
|
search_cutoff_ms,
|
||||||
"searchCutoff",
|
"searchCutoffMs",
|
||||||
analytics,
|
analytics,
|
||||||
|setting: &Option<u64>, req: &HttpRequest| {
|
|setting: &Option<u64>, req: &HttpRequest| {
|
||||||
analytics.publish(
|
analytics.publish(
|
||||||
"Search Cutoff Updated".to_string(),
|
"Search Cutoff Updated".to_string(),
|
||||||
serde_json::json!({"search_cutoff": setting }),
|
serde_json::json!({"search_cutoff_ms": setting }),
|
||||||
Some(req),
|
Some(req),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -675,7 +675,7 @@ generate_configure!(
|
|||||||
pagination,
|
pagination,
|
||||||
faceting,
|
faceting,
|
||||||
embedders,
|
embedders,
|
||||||
search_cutoff
|
search_cutoff_ms
|
||||||
);
|
);
|
||||||
|
|
||||||
pub async fn update_all(
|
pub async fn update_all(
|
||||||
@ -787,7 +787,7 @@ pub async fn update_all(
|
|||||||
"total": new_settings.synonyms.as_ref().set().map(|synonyms| synonyms.len()),
|
"total": new_settings.synonyms.as_ref().set().map(|synonyms| synonyms.len()),
|
||||||
},
|
},
|
||||||
"embedders": crate::routes::indexes::settings::embedder_analytics(new_settings.embedders.as_ref().set()),
|
"embedders": crate::routes::indexes::settings::embedder_analytics(new_settings.embedders.as_ref().set()),
|
||||||
"search_cutoff": new_settings.search_cutoff.as_ref().set(),
|
"search_cutoff_ms": new_settings.search_cutoff_ms.as_ref().set(),
|
||||||
}),
|
}),
|
||||||
Some(&req),
|
Some(&req),
|
||||||
);
|
);
|
||||||
|
@ -16,6 +16,7 @@ pub use server::{default_settings, Server};
|
|||||||
pub struct Value(pub serde_json::Value);
|
pub struct Value(pub serde_json::Value);
|
||||||
|
|
||||||
impl Value {
|
impl Value {
|
||||||
|
#[track_caller]
|
||||||
pub fn uid(&self) -> u64 {
|
pub fn uid(&self) -> u64 {
|
||||||
if let Some(uid) = self["uid"].as_u64() {
|
if let Some(uid) = self["uid"].as_u64() {
|
||||||
uid
|
uid
|
||||||
|
@ -78,7 +78,7 @@ async fn import_dump_v1_movie_raw() {
|
|||||||
"pagination": {
|
"pagination": {
|
||||||
"maxTotalHits": 1000
|
"maxTotalHits": 1000
|
||||||
},
|
},
|
||||||
"searchCutoff": null
|
"searchCutoffMs": null
|
||||||
}
|
}
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
@ -240,7 +240,7 @@ async fn import_dump_v1_movie_with_settings() {
|
|||||||
"pagination": {
|
"pagination": {
|
||||||
"maxTotalHits": 1000
|
"maxTotalHits": 1000
|
||||||
},
|
},
|
||||||
"searchCutoff": null
|
"searchCutoffMs": null
|
||||||
}
|
}
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
@ -388,7 +388,7 @@ async fn import_dump_v1_rubygems_with_settings() {
|
|||||||
"pagination": {
|
"pagination": {
|
||||||
"maxTotalHits": 1000
|
"maxTotalHits": 1000
|
||||||
},
|
},
|
||||||
"searchCutoff": null
|
"searchCutoffMs": null
|
||||||
}
|
}
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
@ -522,7 +522,7 @@ async fn import_dump_v2_movie_raw() {
|
|||||||
"pagination": {
|
"pagination": {
|
||||||
"maxTotalHits": 1000
|
"maxTotalHits": 1000
|
||||||
},
|
},
|
||||||
"searchCutoff": null
|
"searchCutoffMs": null
|
||||||
}
|
}
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
@ -668,7 +668,7 @@ async fn import_dump_v2_movie_with_settings() {
|
|||||||
"pagination": {
|
"pagination": {
|
||||||
"maxTotalHits": 1000
|
"maxTotalHits": 1000
|
||||||
},
|
},
|
||||||
"searchCutoff": null
|
"searchCutoffMs": null
|
||||||
}
|
}
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
@ -813,7 +813,7 @@ async fn import_dump_v2_rubygems_with_settings() {
|
|||||||
"pagination": {
|
"pagination": {
|
||||||
"maxTotalHits": 1000
|
"maxTotalHits": 1000
|
||||||
},
|
},
|
||||||
"searchCutoff": null
|
"searchCutoffMs": null
|
||||||
}
|
}
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
@ -947,7 +947,7 @@ async fn import_dump_v3_movie_raw() {
|
|||||||
"pagination": {
|
"pagination": {
|
||||||
"maxTotalHits": 1000
|
"maxTotalHits": 1000
|
||||||
},
|
},
|
||||||
"searchCutoff": null
|
"searchCutoffMs": null
|
||||||
}
|
}
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
@ -1093,7 +1093,7 @@ async fn import_dump_v3_movie_with_settings() {
|
|||||||
"pagination": {
|
"pagination": {
|
||||||
"maxTotalHits": 1000
|
"maxTotalHits": 1000
|
||||||
},
|
},
|
||||||
"searchCutoff": null
|
"searchCutoffMs": null
|
||||||
}
|
}
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
@ -1238,7 +1238,7 @@ async fn import_dump_v3_rubygems_with_settings() {
|
|||||||
"pagination": {
|
"pagination": {
|
||||||
"maxTotalHits": 1000
|
"maxTotalHits": 1000
|
||||||
},
|
},
|
||||||
"searchCutoff": null
|
"searchCutoffMs": null
|
||||||
}
|
}
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
@ -1372,7 +1372,7 @@ async fn import_dump_v4_movie_raw() {
|
|||||||
"pagination": {
|
"pagination": {
|
||||||
"maxTotalHits": 1000
|
"maxTotalHits": 1000
|
||||||
},
|
},
|
||||||
"searchCutoff": null
|
"searchCutoffMs": null
|
||||||
}
|
}
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
@ -1518,7 +1518,7 @@ async fn import_dump_v4_movie_with_settings() {
|
|||||||
"pagination": {
|
"pagination": {
|
||||||
"maxTotalHits": 1000
|
"maxTotalHits": 1000
|
||||||
},
|
},
|
||||||
"searchCutoff": null
|
"searchCutoffMs": null
|
||||||
}
|
}
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
@ -1663,7 +1663,7 @@ async fn import_dump_v4_rubygems_with_settings() {
|
|||||||
"pagination": {
|
"pagination": {
|
||||||
"maxTotalHits": 1000
|
"maxTotalHits": 1000
|
||||||
},
|
},
|
||||||
"searchCutoff": null
|
"searchCutoffMs": null
|
||||||
}
|
}
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
@ -1908,7 +1908,7 @@ async fn import_dump_v6_containing_experimental_features() {
|
|||||||
"pagination": {
|
"pagination": {
|
||||||
"maxTotalHits": 1000
|
"maxTotalHits": 1000
|
||||||
},
|
},
|
||||||
"searchCutoff": null
|
"searchCutoffMs": null
|
||||||
}
|
}
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
|
@ -843,7 +843,7 @@ async fn test_degraded_score_details() {
|
|||||||
|
|
||||||
index.add_documents(json!(documents), None).await;
|
index.add_documents(json!(documents), None).await;
|
||||||
// We can't really use anything else than 0ms here; otherwise, the test will get flaky.
|
// We can't really use anything else than 0ms here; otherwise, the test will get flaky.
|
||||||
let (res, _code) = index.update_settings(json!({ "searchCutoff": 0 })).await;
|
let (res, _code) = index.update_settings(json!({ "searchCutoffMs": 0 })).await;
|
||||||
index.wait_task(res.uid()).await;
|
index.wait_task(res.uid()).await;
|
||||||
|
|
||||||
index
|
index
|
||||||
@ -855,7 +855,7 @@ async fn test_degraded_score_details() {
|
|||||||
}),
|
}),
|
||||||
|response, code| {
|
|response, code| {
|
||||||
meili_snap::snapshot!(code, @"200 OK");
|
meili_snap::snapshot!(code, @"200 OK");
|
||||||
meili_snap::snapshot!(meili_snap::json_string!(response), @r###"
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".processingTimeMs" => "[duration]" }), @r###"
|
||||||
{
|
{
|
||||||
"hits": [
|
"hits": [
|
||||||
{
|
{
|
||||||
@ -905,7 +905,7 @@ async fn test_degraded_score_details() {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"query": "b",
|
"query": "b",
|
||||||
"processingTimeMs": 0,
|
"processingTimeMs": "[duration]",
|
||||||
"limit": 20,
|
"limit": 20,
|
||||||
"offset": 0,
|
"offset": 0,
|
||||||
"estimatedTotalHits": 3
|
"estimatedTotalHits": 3
|
||||||
|
@ -35,7 +35,7 @@ static DEFAULT_SETTINGS_VALUES: Lazy<HashMap<&'static str, Value>> = Lazy::new(|
|
|||||||
"maxTotalHits": json!(1000),
|
"maxTotalHits": json!(1000),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
map.insert("search_cutoff", json!(null));
|
map.insert("search_cutoff_ms", json!(null));
|
||||||
map
|
map
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ async fn get_settings() {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
assert_eq!(settings["proximityPrecision"], json!("byWord"));
|
assert_eq!(settings["proximityPrecision"], json!("byWord"));
|
||||||
assert_eq!(settings["searchCutoff"], json!(null));
|
assert_eq!(settings["searchCutoffMs"], json!(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
@ -288,7 +288,7 @@ test_setting_routes!(
|
|||||||
synonyms put,
|
synonyms put,
|
||||||
pagination patch,
|
pagination patch,
|
||||||
faceting patch,
|
faceting patch,
|
||||||
search_cutoff put
|
search_cutoff_ms put
|
||||||
);
|
);
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
|
Loading…
Reference in New Issue
Block a user