Remove old search URLs

This commit is contained in:
Bill Thiede 2024-07-22 07:25:15 -07:00
parent 834efc5c94
commit cdb64ed952

View File

@ -33,34 +33,6 @@ async fn refresh(nm: &State<Notmuch>) -> Result<Json<String>, Debug<NotmuchError
Ok(Json(String::from_utf8_lossy(&nm.new()?).to_string())) Ok(Json(String::from_utf8_lossy(&nm.new()?).to_string()))
} }
#[get("/search")]
async fn search_all(
nm: &State<Notmuch>,
) -> Result<Json<shared::SearchResult>, Debug<NotmuchError>> {
search(nm, "*", None, None).await
}
#[get("/search/<query>?<page>&<results_per_page>")]
async fn search(
nm: &State<Notmuch>,
query: &str,
page: Option<usize>,
results_per_page: Option<usize>,
) -> Result<Json<shared::SearchResult>, Debug<NotmuchError>> {
let page = page.unwrap_or(0);
let results_per_page = results_per_page.unwrap_or(20);
let query = urlencoding::decode(query).map_err(NotmuchError::from)?;
info!(" search '{query}'");
let res = shared::SearchResult {
summary: nm.search(&query, page * results_per_page, results_per_page)?,
query: query.to_string(),
page,
results_per_page,
total: nm.count(&query)?,
};
Ok(Json(res))
}
#[get("/show/<query>/pretty")] #[get("/show/<query>/pretty")]
async fn show_pretty( async fn show_pretty(
nm: &State<Notmuch>, nm: &State<Notmuch>,
@ -237,8 +209,6 @@ async fn main() -> Result<(), Box<dyn Error>> {
routes![ routes![
original, original,
refresh, refresh,
search_all,
search,
show_pretty, show_pretty,
show, show,
graphql_query, graphql_query,