Compare commits

..

No commits in common. "3b69c5e74b8001e18ca8f8f802c74f19d359f8b6" and "da27f022377d30304c52566806d408123c0370f2" have entirely different histories.

8 changed files with 19 additions and 26 deletions

10
Cargo.lock generated
View File

@ -2469,7 +2469,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "letterbox"
version = "0.0.28"
version = "0.0.27"
dependencies = [
"build-info",
"build-info-build",
@ -2988,7 +2988,7 @@ dependencies = [
[[package]]
name = "notmuch"
version = "0.0.28"
version = "0.0.27"
dependencies = [
"itertools 0.10.5",
"log",
@ -3625,7 +3625,7 @@ dependencies = [
[[package]]
name = "procmail2notmuch"
version = "0.0.28"
version = "0.0.27"
dependencies = [
"anyhow",
]
@ -4547,7 +4547,7 @@ dependencies = [
[[package]]
name = "server"
version = "0.0.28"
version = "0.0.27"
dependencies = [
"ammonia",
"anyhow",
@ -4646,7 +4646,7 @@ dependencies = [
[[package]]
name = "shared"
version = "0.0.28"
version = "0.0.27"
dependencies = [
"build-info",
"notmuch",

View File

@ -1,6 +1,6 @@
[package]
name = "notmuch"
version = "0.0.28"
version = "0.0.27"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,6 +1,6 @@
[package]
name = "procmail2notmuch"
version = "0.0.28"
version = "0.0.27"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,6 +1,6 @@
[package]
name = "server"
version = "0.0.28"
version = "0.0.27"
edition = "2021"
default-run = "server"

View File

@ -168,13 +168,6 @@ fn graphiql() -> content::RawHtml<String> {
#[rocket::post("/create-news-db")]
fn create_news_db(config: &State<Config>) -> Result<String, Debug<ServerError>> {
create_news_db_impl(config)?;
Ok(format!(
"DB created in {}\n",
config.newsreader_tantivy_db_path
))
}
fn create_news_db_impl(config: &Config) -> Result<(), ServerError> {
std::fs::remove_dir_all(&config.newsreader_tantivy_db_path).map_err(ServerError::from)?;
std::fs::create_dir_all(&config.newsreader_tantivy_db_path).map_err(ServerError::from)?;
use tantivy::schema::*;
@ -190,7 +183,10 @@ fn create_news_db_impl(config: &Config) -> Result<(), ServerError> {
let schema = schema_builder.build();
Index::create_in_dir(&config.newsreader_tantivy_db_path, schema).map_err(ServerError::from)?;
Ok(())
Ok(format!(
"DB created in {}\n",
config.newsreader_tantivy_db_path
))
}
#[rocket::post("/reindex-news-db")]
@ -352,13 +348,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
std::fs::create_dir_all(&config.slurp_cache_path)?;
}
let pool = PgPool::connect(&config.newsreader_database_url).await?;
let tantivy_newsreader_index = match Index::open_in_dir(&config.newsreader_tantivy_db_path) {
Ok(idx) => idx,
Err(_) => {
create_news_db_impl(&config)?;
Index::open_in_dir(&config.newsreader_tantivy_db_path)?
}
};
let tantivy_newsreader_index = Index::open_in_dir(&config.newsreader_tantivy_db_path)?;
let tantivy_newsreader_reader = tantivy_newsreader_index.reader()?;
let schema = Schema::build(QueryRoot, Mutation, EmptySubscription)
.data(Notmuch::default())

View File

@ -1,6 +1,6 @@
[package]
name = "shared"
version = "0.0.28"
version = "0.0.27"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,5 +1,5 @@
[package]
version = "0.0.28"
version = "0.0.27"
name = "letterbox"
repository = "https://github.com/seed-rs/seed-quickstart"
authors = ["Bill Thiede <git@xinu.tv>"]

View File

@ -1,4 +1,7 @@
use std::collections::HashSet;
use std::{
collections::{hash_map::DefaultHasher, HashSet},
hash::{Hash, Hasher},
};
use chrono::{DateTime, Datelike, Duration, Local, Utc};
use human_format::{Formatter, Scales};