Skip to content

Commit

Permalink
Add search.index_format into the serialized config (#2165) (#2196)
Browse files Browse the repository at this point in the history
* Add search into the serialized config (#2165)

* Only expose index_format

* Create config.search struct

* cargo fmt
  • Loading branch information
Raymi306 authored and Keats committed Dec 18, 2023
1 parent d72ebb1 commit 8e37025
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions components/config/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ pub struct SerializedConfig<'a> {
build_search_index: bool,
extra: &'a HashMap<String, Toml>,
markdown: &'a markup::Markdown,
search: search::SerializedSearch<'a>,
}

impl Config {
Expand Down Expand Up @@ -331,6 +332,7 @@ impl Config {
build_search_index: options.build_search_index,
extra: &self.extra,
markdown: &self.markdown,
search: self.search.serialize(),
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions components/config/src/config/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

0 comments on commit 8e37025

Please sign in to comment.