mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 10:37:41 +08:00
change facetedAttributes to attributesForFaceting
This commit is contained in:
parent
fcf1d4e922
commit
55fadd7f87
@ -54,7 +54,7 @@ impl Index {
|
|||||||
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)),
|
attributes_for_faceting: Some(Some(faceted_attributes)),
|
||||||
ranking_rules: Some(Some(criteria)),
|
ranking_rules: Some(Some(criteria)),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ pub struct Settings {
|
|||||||
pub searchable_attributes: Option<Option<Vec<String>>>,
|
pub searchable_attributes: Option<Option<Vec<String>>>,
|
||||||
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub faceted_attributes: Option<Option<HashMap<String, String>>>,
|
pub attributes_for_faceting: Option<Option<HashMap<String, String>>>,
|
||||||
|
|
||||||
#[serde(
|
#[serde(
|
||||||
default,
|
default,
|
||||||
@ -50,7 +50,7 @@ impl Settings {
|
|||||||
Self {
|
Self {
|
||||||
displayed_attributes: Some(None),
|
displayed_attributes: Some(None),
|
||||||
searchable_attributes: Some(None),
|
searchable_attributes: Some(None),
|
||||||
faceted_attributes: Some(None),
|
attributes_for_faceting: Some(None),
|
||||||
ranking_rules: Some(None),
|
ranking_rules: Some(None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ impl Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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 facet_types) = settings.faceted_attributes {
|
if let Some(ref facet_types) = settings.attributes_for_faceting {
|
||||||
let facet_types = facet_types.clone().unwrap_or_else(|| HashMap::new());
|
let facet_types = facet_types.clone().unwrap_or_else(|| HashMap::new());
|
||||||
builder.set_faceted_fields(facet_types);
|
builder.set_faceted_fields(facet_types);
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ macro_rules! make_setting_route {
|
|||||||
make_setting_route!(
|
make_setting_route!(
|
||||||
"/indexes/{index_uid}/settings/attributes-for-faceting",
|
"/indexes/{index_uid}/settings/attributes-for-faceting",
|
||||||
std::collections::HashMap<String, String>,
|
std::collections::HashMap<String, String>,
|
||||||
faceted_attributes
|
attributes_for_faceting
|
||||||
);
|
);
|
||||||
|
|
||||||
make_setting_route!(
|
make_setting_route!(
|
||||||
@ -126,7 +126,7 @@ macro_rules! create_services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
create_services!(
|
create_services!(
|
||||||
faceted_attributes,
|
attributes_for_faceting,
|
||||||
displayed_attributes,
|
displayed_attributes,
|
||||||
searchable_attributes
|
searchable_attributes
|
||||||
);
|
);
|
||||||
|
@ -19,7 +19,8 @@ async fn get_settings() {
|
|||||||
assert_eq!(settings.keys().len(), 4);
|
assert_eq!(settings.keys().len(), 4);
|
||||||
assert_eq!(settings["displayedAttributes"], json!(["*"]));
|
assert_eq!(settings["displayedAttributes"], json!(["*"]));
|
||||||
assert_eq!(settings["searchableAttributes"], json!(["*"]));
|
assert_eq!(settings["searchableAttributes"], json!(["*"]));
|
||||||
assert_eq!(settings["facetedAttributes"], json!({}));
|
println!("{:?}", settings);
|
||||||
|
assert_eq!(settings["attributesForFaceting"], json!({}));
|
||||||
assert_eq!(settings["rankingRules"], json!(["typo", "words", "proximity", "attribute", "wordsPosition", "exactness"]));
|
assert_eq!(settings["rankingRules"], json!(["typo", "words", "proximity", "attribute", "wordsPosition", "exactness"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user