|
|
|
@ -6,13 +6,7 @@ use chrono::{Datelike, Utc};
|
|
|
|
|
use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl};
|
|
|
|
|
use itertools::Itertools;
|
|
|
|
|
use riker::actors::*;
|
|
|
|
|
use std::{
|
|
|
|
|
cmp,
|
|
|
|
|
fs::create_dir_all,
|
|
|
|
|
io,
|
|
|
|
|
path::Path,
|
|
|
|
|
sync::{Arc, Mutex},
|
|
|
|
|
};
|
|
|
|
|
use std::{cmp, fs::create_dir_all, io, path::Path, sync::Mutex};
|
|
|
|
|
use tantivy::{
|
|
|
|
|
collector::TopDocs, directory::MmapDirectory, schema::*, Index, IndexReader, IndexWriter,
|
|
|
|
|
ReloadPolicy, TantivyError, Term,
|
|
|
|
@ -93,7 +87,7 @@ impl Searcher {
|
|
|
|
|
///
|
|
|
|
|
/// The panic messages are normally explicit enough for a human to
|
|
|
|
|
/// understand how to fix the issue when they see it.
|
|
|
|
|
pub fn new(db_pool: DbPool) -> Arc<Self> {
|
|
|
|
|
pub fn new(db_pool: DbPool) -> Self {
|
|
|
|
|
// We try to open the index a first time
|
|
|
|
|
let searcher = match Self::open(
|
|
|
|
|
&CONFIG.search_index,
|
|
|
|
@ -169,7 +163,7 @@ Then try to restart Plume
|
|
|
|
|
e => Err(e).unwrap(),
|
|
|
|
|
},
|
|
|
|
|
Err(_) => panic!("Unexpected error while opening search index"),
|
|
|
|
|
Ok(s) => Arc::new(s),
|
|
|
|
|
Ok(s) => s,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|