mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 09:04:59 +08:00
enable criterion setting
This commit is contained in:
parent
b8ebf07555
commit
65ca80bdde
@ -106,11 +106,17 @@ impl Data {
|
|||||||
.map(|(k, v)| (k, v.to_string()))
|
.map(|(k, v)| (k, v.to_string()))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
let criteria = index
|
||||||
|
.criteria(&txn)?
|
||||||
|
.into_iter()
|
||||||
|
.map(|v| format!("{:?}", v))
|
||||||
|
.collect();
|
||||||
|
|
||||||
Ok(Settings {
|
Ok(Settings {
|
||||||
displayed_attributes: Some(Some(displayed_attributes)),
|
displayed_attributes: Some(Some(displayed_attributes)),
|
||||||
searchable_attributes: Some(Some(searchable_attributes)),
|
searchable_attributes: Some(Some(searchable_attributes)),
|
||||||
faceted_attributes: Some(Some(faceted_attributes)),
|
faceted_attributes: Some(Some(faceted_attributes)),
|
||||||
criteria: None,
|
ranking_rules: Some(Some(criteria)),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ impl UpdateHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We transpose the settings JSON struct into a real setting update.
|
// We transpose the settings JSON struct into a real setting update.
|
||||||
if let Some(ref criteria) = settings.criteria {
|
if let Some(ref criteria) = settings.ranking_rules {
|
||||||
match criteria {
|
match criteria {
|
||||||
Some(criteria) => builder.set_criteria(criteria.clone()),
|
Some(criteria) => builder.set_criteria(criteria.clone()),
|
||||||
None => builder.reset_criteria(),
|
None => builder.reset_criteria(),
|
||||||
|
@ -83,7 +83,7 @@ pub struct Settings {
|
|||||||
deserialize_with = "deserialize_some",
|
deserialize_with = "deserialize_some",
|
||||||
skip_serializing_if = "Option::is_none",
|
skip_serializing_if = "Option::is_none",
|
||||||
)]
|
)]
|
||||||
pub criteria: Option<Option<Vec<String>>>,
|
pub ranking_rules: Option<Option<Vec<String>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Settings {
|
impl Settings {
|
||||||
@ -92,7 +92,7 @@ impl Settings {
|
|||||||
displayed_attributes: Some(None),
|
displayed_attributes: Some(None),
|
||||||
searchable_attributes: Some(None),
|
searchable_attributes: Some(None),
|
||||||
faceted_attributes: Some(None),
|
faceted_attributes: Some(None),
|
||||||
criteria: Some(None),
|
ranking_rules: Some(None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,11 +103,11 @@ make_setting_route!(
|
|||||||
//distinct_attribute
|
//distinct_attribute
|
||||||
//);
|
//);
|
||||||
|
|
||||||
//make_setting_route!(
|
make_setting_route!(
|
||||||
//"/indexes/{index_uid}/settings/ranking-rules",
|
"/indexes/{index_uid}/settings/ranking-rules",
|
||||||
//Vec<String>,
|
Vec<String>,
|
||||||
//ranking_rules
|
ranking_rules
|
||||||
//);
|
);
|
||||||
|
|
||||||
macro_rules! create_services {
|
macro_rules! create_services {
|
||||||
($($mod:ident),*) => {
|
($($mod:ident),*) => {
|
||||||
@ -128,7 +128,8 @@ macro_rules! create_services {
|
|||||||
create_services!(
|
create_services!(
|
||||||
faceted_attributes,
|
faceted_attributes,
|
||||||
displayed_attributes,
|
displayed_attributes,
|
||||||
searchable_attributes
|
searchable_attributes,
|
||||||
|
ranking_rules
|
||||||
);
|
);
|
||||||
|
|
||||||
#[post("/indexes/{index_uid}/settings", wrap = "Authentication::Private")]
|
#[post("/indexes/{index_uid}/settings", wrap = "Authentication::Private")]
|
||||||
|
Loading…
Reference in New Issue
Block a user