server: improve tantivy performance by reusing IndexReader

Also improve a bunch of trace logging
This commit is contained in:
2024-12-15 14:46:10 -08:00
parent 05cdcec244
commit 6d8b2de608
5 changed files with 67 additions and 42 deletions

View File

@@ -49,7 +49,7 @@ pub fn threadset_to_messages(thread_set: notmuch::ThreadSet) -> Result<Vec<Messa
Ok(Vec::new())
}
#[instrument(name="nm::count", skip_all, fields(query=?query))]
#[instrument(name="nm::count", skip_all, fields(query=%query))]
pub async fn count(nm: &Notmuch, query: &Query) -> Result<usize, ServerError> {
if !is_notmuch_query(query) {
return Ok(0);
@@ -58,7 +58,7 @@ pub async fn count(nm: &Notmuch, query: &Query) -> Result<usize, ServerError> {
Ok(nm.count(&query)?)
}
#[instrument(name="nm::search", skip_all, fields(query=?query))]
#[instrument(name="nm::search", skip_all, fields(query=%query))]
pub async fn search(
nm: &Notmuch,
after: Option<i32>,
@@ -856,7 +856,7 @@ fn render_content_type_tree(m: &ParsedMail) -> String {
)
}
#[instrument(name="nm::set_read_status", skip_all, fields(query=?query, unread=unread))]
#[instrument(name="nm::set_read_status", skip_all, fields(query=%query, unread=unread))]
pub async fn set_read_status<'ctx>(
nm: &Notmuch,
query: &Query,