diff --git a/pgml-dashboard/src/utils/markdown.rs b/pgml-dashboard/src/utils/markdown.rs index b13636c6a..f9b345508 100644 --- a/pgml-dashboard/src/utils/markdown.rs +++ b/pgml-dashboard/src/utils/markdown.rs @@ -1193,7 +1193,24 @@ impl SearchIndex { } pub fn open() -> tantivy::Result { - let index = tantivy::Index::open_in_dir(&Self::path())?; + let path = Self::path(); + + if !path.exists() { + std::fs::create_dir(&path) + .expect("failed to create search_index directory, is the filesystem writable?"); + } + + let index = match tantivy::Index::open_in_dir(&path) { + Ok(index) => index, + Err(err) => { + warn!( + "Failed to open Tantivy index in '{}', creating an empty one, error: {}", + path.display(), + err + ); + Index::create_in_dir(&path, Self::schema())? + } + }; let reader = index.reader_builder().try_into()?; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy