From 94d75fa0d95e5300175f80b5b588290d4abedc36 Mon Sep 17 00:00:00 2001 From: Andrew Langmeier Date: Mon, 1 May 2023 15:40:29 -0400 Subject: [PATCH] Add search.index_format into the serialized config (#2165) (#2196) * Add search into the serialized config (#2165) * Only expose index_format * Create config.search struct * cargo fmt --- components/config/src/config/mod.rs | 2 ++ components/config/src/config/search.rs | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/components/config/src/config/mod.rs b/components/config/src/config/mod.rs index e0674276dd..2cda172127 100644 --- a/components/config/src/config/mod.rs +++ b/components/config/src/config/mod.rs @@ -109,6 +109,7 @@ pub struct SerializedConfig<'a> { build_search_index: bool, extra: &'a HashMap, markdown: &'a markup::Markdown, + search: search::SerializedSearch<'a>, } impl Config { @@ -331,6 +332,7 @@ impl Config { build_search_index: options.build_search_index, extra: &self.extra, markdown: &self.markdown, + search: self.search.serialize(), } } } diff --git a/components/config/src/config/search.rs b/components/config/src/config/search.rs index c96a874847..26c78f7464 100644 --- a/components/config/src/config/search.rs +++ b/components/config/src/config/search.rs @@ -44,3 +44,14 @@ impl Default for Search { } } } + +impl Search { + pub fn serialize(&self) -> SerializedSearch { + SerializedSearch { index_format: &self.index_format } + } +} + +#[derive(Serialize)] +pub struct SerializedSearch<'a> { + pub index_format: &'a IndexFormat, +}