mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-11-04 09:56:28 +00:00 
			
		
		
		
	Update the HTTP settings route to accept the faceted fields
This commit is contained in:
		
							
								
								
									
										10
									
								
								http-ui/Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										10
									
								
								http-ui/Cargo.lock
									
									
									
										generated
									
									
									
								
							@@ -989,6 +989,7 @@ dependencies = [
 | 
			
		||||
 "near-proximity",
 | 
			
		||||
 "obkv",
 | 
			
		||||
 "once_cell",
 | 
			
		||||
 "ordered-float",
 | 
			
		||||
 "rayon",
 | 
			
		||||
 "ringtail",
 | 
			
		||||
 "roaring",
 | 
			
		||||
@@ -1205,6 +1206,15 @@ version = "0.3.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "ordered-float"
 | 
			
		||||
version = "2.0.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "9fe9037165d7023b1228bc4ae9a2fa1a2b0095eca6c2998c624723dfd01314a5"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "num-traits",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "page_size"
 | 
			
		||||
version = "0.4.2"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
use std::borrow::Cow;
 | 
			
		||||
use std::collections::HashSet;
 | 
			
		||||
use std::collections::{HashMap, HashSet};
 | 
			
		||||
use std::fs::{File, create_dir_all};
 | 
			
		||||
use std::net::SocketAddr;
 | 
			
		||||
use std::path::PathBuf;
 | 
			
		||||
@@ -210,6 +210,8 @@ enum UpdateMetaProgress {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, Clone, Serialize, Deserialize)]
 | 
			
		||||
#[serde(deny_unknown_fields)]
 | 
			
		||||
#[serde(rename_all = "camelCase")]
 | 
			
		||||
struct Settings {
 | 
			
		||||
    #[serde(
 | 
			
		||||
        default,
 | 
			
		||||
@@ -224,6 +226,9 @@ struct Settings {
 | 
			
		||||
        skip_serializing_if = "Option::is_none",
 | 
			
		||||
    )]
 | 
			
		||||
    searchable_attributes: Option<Option<Vec<String>>>,
 | 
			
		||||
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    faceted_attributes: Option<HashMap<String, String>>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Any value that is present is considered Some value, including null.
 | 
			
		||||
@@ -367,6 +372,11 @@ async fn main() -> anyhow::Result<()> {
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    // We transpose the settings JSON struct into a real setting update.
 | 
			
		||||
                    if let Some(facet_types) = settings.faceted_attributes {
 | 
			
		||||
                        builder.set_faceted_fields(facet_types);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    let result = builder.execute(|indexing_step| {
 | 
			
		||||
                        let (current, total) = match indexing_step {
 | 
			
		||||
                            TransformFromUserIntoGenericFormat { documents_seen } => (documents_seen, None),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user