server: warn on failure to open tantivy
This commit is contained in:
parent
4ad963c3be
commit
ac4aaeb0f7
@ -1,6 +1,6 @@
|
|||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use log::{debug, error, info};
|
use log::{debug, error, info, warn};
|
||||||
use sqlx::{postgres::PgPool, types::time::PrimitiveDateTime};
|
use sqlx::{postgres::PgPool, types::time::PrimitiveDateTime};
|
||||||
use tantivy::{
|
use tantivy::{
|
||||||
collector::{DocSetCollector, TopDocs},
|
collector::{DocSetCollector, TopDocs},
|
||||||
@ -31,7 +31,8 @@ pub struct TantivyConnection {
|
|||||||
fn get_index(db_path: &str) -> Result<Index, TantivyError> {
|
fn get_index(db_path: &str) -> Result<Index, TantivyError> {
|
||||||
Ok(match Index::open_in_dir(db_path) {
|
Ok(match Index::open_in_dir(db_path) {
|
||||||
Ok(idx) => idx,
|
Ok(idx) => idx,
|
||||||
Err(_) => {
|
Err(err) => {
|
||||||
|
warn!("Failed to open {db_path}: {err}");
|
||||||
create_news_db(db_path)?;
|
create_news_db(db_path)?;
|
||||||
Index::open_in_dir(db_path)?
|
Index::open_in_dir(db_path)?
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user