server: warn on failure to open tantivy

This commit is contained in:
Bill Thiede 2024-12-15 15:43:44 -08:00
parent 4ad963c3be
commit ac4aaeb0f7

View File

@ -1,6 +1,6 @@
use std::collections::HashSet;
use log::{debug, error, info};
use log::{debug, error, info, warn};
use sqlx::{postgres::PgPool, types::time::PrimitiveDateTime};
use tantivy::{
collector::{DocSetCollector, TopDocs},
@ -31,7 +31,8 @@ pub struct TantivyConnection {
fn get_index(db_path: &str) -> Result<Index, TantivyError> {
Ok(match Index::open_in_dir(db_path) {
Ok(idx) => idx,
Err(_) => {
Err(err) => {
warn!("Failed to open {db_path}: {err}");
create_news_db(db_path)?;
Index::open_in_dir(db_path)?
}