server: fix paging if only notmuch results are found
This commit is contained in:
@@ -50,7 +50,13 @@ pub async fn search(
|
||||
last: Option<i32>,
|
||||
query: String,
|
||||
) -> Result<Vec<(i32, ThreadSummary)>, async_graphql::Error> {
|
||||
let (offset, limit) = compute_offset_limit(after, before, first, last);
|
||||
let (offset, mut limit) = compute_offset_limit(after, before, first, last);
|
||||
if before.is_none() {
|
||||
// When searching forward, the +1 is to see if there are more pages of data available.
|
||||
// Searching backwards implies there's more pages forward, because the value represented by
|
||||
// `before` is on the next page.
|
||||
limit = limit + 1;
|
||||
}
|
||||
Ok(nm
|
||||
.search(&query, offset as usize, limit as usize)?
|
||||
.0
|
||||
|
||||
Reference in New Issue
Block a user