mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-11-04 01:46:28 +00:00 
			
		
		
		
	change facetedAttributes to attributesForFaceting
This commit is contained in:
		@@ -54,7 +54,7 @@ impl Index {
 | 
			
		||||
        Ok(Settings {
 | 
			
		||||
            displayed_attributes: Some(Some(displayed_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)),
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@ pub struct Settings {
 | 
			
		||||
    pub searchable_attributes: Option<Option<Vec<String>>>,
 | 
			
		||||
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub faceted_attributes: Option<Option<HashMap<String, String>>>,
 | 
			
		||||
    pub attributes_for_faceting: Option<Option<HashMap<String, String>>>,
 | 
			
		||||
 | 
			
		||||
    #[serde(
 | 
			
		||||
        default,
 | 
			
		||||
@@ -50,7 +50,7 @@ impl Settings {
 | 
			
		||||
        Self {
 | 
			
		||||
            displayed_attributes: Some(None),
 | 
			
		||||
            searchable_attributes: Some(None),
 | 
			
		||||
            faceted_attributes: Some(None),
 | 
			
		||||
            attributes_for_faceting: Some(None),
 | 
			
		||||
            ranking_rules: Some(None),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -158,7 +158,7 @@ impl Index {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 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());
 | 
			
		||||
            builder.set_faceted_fields(facet_types);
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -82,7 +82,7 @@ macro_rules! make_setting_route {
 | 
			
		||||
make_setting_route!(
 | 
			
		||||
    "/indexes/{index_uid}/settings/attributes-for-faceting",
 | 
			
		||||
    std::collections::HashMap<String, String>,
 | 
			
		||||
    faceted_attributes
 | 
			
		||||
    attributes_for_faceting
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
make_setting_route!(
 | 
			
		||||
@@ -126,7 +126,7 @@ macro_rules! create_services {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
create_services!(
 | 
			
		||||
    faceted_attributes,
 | 
			
		||||
    attributes_for_faceting,
 | 
			
		||||
    displayed_attributes,
 | 
			
		||||
    searchable_attributes
 | 
			
		||||
);
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,8 @@ async fn get_settings() {
 | 
			
		||||
    assert_eq!(settings.keys().len(), 4);
 | 
			
		||||
    assert_eq!(settings["displayedAttributes"], 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"]));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user