diff --git a/server/src/graphql.rs b/server/src/graphql.rs index 92f4771..10dd394 100644 --- a/server/src/graphql.rs +++ b/server/src/graphql.rs @@ -263,6 +263,7 @@ pub struct Tag { struct SearchCursor { newsreader_offset: i32, notmuch_offset: i32, + #[cfg(feature = "tantivy")] tantivy_offset: i32, } @@ -328,10 +329,12 @@ impl QueryRoot { ); let newsreader_after = after.as_ref().map(|sc| sc.newsreader_offset); let notmuch_after = after.as_ref().map(|sc| sc.notmuch_offset); + #[cfg(feature = "tantivy")] let tantivy_after = after.as_ref().map(|sc| sc.tantivy_offset); let newsreader_before = before.as_ref().map(|sc| sc.newsreader_offset); let notmuch_before = before.as_ref().map(|sc| sc.notmuch_offset); + #[cfg(feature = "tantivy")] let tantivy_before = before.as_ref().map(|sc| sc.tantivy_offset); let first = first.map(|v| v as i32); let last = last.map(|v| v as i32); @@ -386,6 +389,7 @@ impl QueryRoot { results.sort_by_key(|item| match item { ThreadSummaryCursor::Newsreader(_, ts) => -ts.timestamp, ThreadSummaryCursor::Notmuch(_, ts) => -ts.timestamp, + #[cfg(feature = "tantivy")] ThreadSummaryCursor::Tantivy(_, ts) => -ts.timestamp, }); @@ -410,6 +414,7 @@ impl QueryRoot { let mut connection = Connection::new(has_previous_page, has_next_page); let mut newsreader_offset = 0; let mut notmuch_offset = 0; + #[cfg(feature = "tantivy")] let mut tantivy_offset = 0; connection.edges.extend(results.into_iter().map(|item| { @@ -423,6 +428,7 @@ impl QueryRoot { thread_summary = ts; notmuch_offset = offset; } + #[cfg(feature = "tantivy")] ThreadSummaryCursor::Tantivy(offset, ts) => { thread_summary = ts; tantivy_offset = offset; @@ -431,6 +437,7 @@ impl QueryRoot { let cur = OpaqueCursor(SearchCursor { newsreader_offset, notmuch_offset, + #[cfg(feature = "tantivy")] tantivy_offset, }); Edge::new(cur, thread_summary) @@ -473,6 +480,7 @@ impl QueryRoot { enum ThreadSummaryCursor { Newsreader(i32, ThreadSummary), Notmuch(i32, ThreadSummary), + #[cfg(feature = "tantivy")] Tantivy(i32, ThreadSummary), } async fn newsreader_search( diff --git a/server/src/lib.rs b/server/src/lib.rs index a85f077..afa8521 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -258,7 +258,7 @@ impl Transformer for SlurpContents { let Some(selectors) = self.get_selectors(&link) else { return Ok(html.to_string()); }; - let mut cacher = self.cacher.lock().await; + let cacher = self.cacher.lock().await; let body = if let Some(body) = cacher.get(link.as_str()) { info!("cache hit for {link}"); String::from_utf8_lossy(&body).to_string()