diff --git a/src/subcommand/serve.rs b/src/subcommand/serve.rs index 57cc2e012..dd10607f2 100644 --- a/src/subcommand/serve.rs +++ b/src/subcommand/serve.rs @@ -184,6 +184,13 @@ struct Settings { skip_serializing_if = "Option::is_none", )] displayed_attributes: Option>>, + + #[serde( + default, + deserialize_with = "deserialize_some", + skip_serializing_if = "Option::is_none", + )] + searchable_attributes: Option>>, } // Any value that is present is considered Some value, including null. @@ -300,6 +307,14 @@ pub fn run(opt: Opt) -> anyhow::Result<()> { let mut wtxn = index_cloned.write_txn()?; let mut builder = update_builder.settings(&mut wtxn, &index_cloned); + // We transpose the settings JSON struct into a real setting update. + if let Some(names) = settings.searchable_attributes { + match names { + Some(names) => builder.set_searchable_fields(names), + None => builder.reset_searchable_fields(), + } + } + // We transpose the settings JSON struct into a real setting update. if let Some(names) = settings.displayed_attributes { match names {