Add pagination to search results.
Move to shared definition of json requests between client/server.
This commit is contained in:
@@ -478,8 +478,19 @@ impl Notmuch {
|
||||
self.run_notmuch(std::iter::empty::<&str>())
|
||||
}
|
||||
|
||||
pub fn search(&self, query: &str) -> Result<SearchSummary, NotmuchError> {
|
||||
let res = self.run_notmuch(["search", "--format=json", "--limit=20", query])?;
|
||||
pub fn search(
|
||||
&self,
|
||||
query: &str,
|
||||
offset: usize,
|
||||
limit: usize,
|
||||
) -> Result<SearchSummary, NotmuchError> {
|
||||
let res = self.run_notmuch([
|
||||
"search",
|
||||
"--format=json",
|
||||
&format!("--offset={offset}"),
|
||||
&format!("--limit={limit}"),
|
||||
query,
|
||||
])?;
|
||||
Ok(serde_json::from_slice(&res)?)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user