From b8011de3e819cf1b50c5ad7a2f5e51d94cdceb2a Mon Sep 17 00:00:00 2001 From: Matt Ickstadt Date: Wed, 13 Jun 2018 14:15:27 -0500 Subject: [PATCH] Warn when search index is >10MB --- src/renderer/html_handlebars/search.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/renderer/html_handlebars/search.rs b/src/renderer/html_handlebars/search.rs index a6f9a89d..310d8f09 100644 --- a/src/renderer/html_handlebars/search.rs +++ b/src/renderer/html_handlebars/search.rs @@ -26,6 +26,9 @@ pub fn create_files(search_config: &Search, destination: &Path, book: &Book) -> let index = write_to_js(index, &search_config, doc_urls)?; debug!("Writing search index ✓"); + if index.len() > 10_000_000 { + warn!("searchindex.js is very large ({} bytes)", index.len()); + } if search_config.copy_js { utils::fs::write_file(destination, "searchindex.js", index.as_bytes())?;