Remove old search URLs
This commit is contained in:
parent
834efc5c94
commit
cdb64ed952
@ -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()))
|
||||
}
|
||||
|
||||
#[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")]
|
||||
async fn show_pretty(
|
||||
nm: &State<Notmuch>,
|
||||
@ -237,8 +209,6 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
routes![
|
||||
original,
|
||||
refresh,
|
||||
search_all,
|
||||
search,
|
||||
show_pretty,
|
||||
show,
|
||||
graphql_query,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user