aboutsummaryrefslogtreecommitdiff
path: root/src/imap/mailbox_view.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-01-06 18:01:44 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-01-06 18:01:44 +0100
commitf58904f5bb3dbd429555c406c867f850654843a6 (patch)
tree9b5d62e88dce84fe33cfe1f87ef7e3fb3e23cc2e /src/imap/mailbox_view.rs
parentd495538d55c723d8a088c32327258ce10c555a2e (diff)
downloadaerogramme-f58904f5bb3dbd429555c406c867f850654843a6.tar.gz
aerogramme-f58904f5bb3dbd429555c406c867f850654843a6.zip
Search can now filter on index data
Diffstat (limited to 'src/imap/mailbox_view.rs')
-rw-r--r--src/imap/mailbox_view.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/imap/mailbox_view.rs b/src/imap/mailbox_view.rs
index e4ffdcd..a07f6a4 100644
--- a/src/imap/mailbox_view.rs
+++ b/src/imap/mailbox_view.rs
@@ -319,12 +319,18 @@ impl MailboxView {
let selection = self.index().fetch(&seq_set, seq_type.is_uid())?;
// 3. Filter the selection based on the ID / UID / Flags
+ let selection = crit.filter_on_idx(&selection);
- // 4. If needed, filter the selection based on the metadata
- let _need_meta = crit.need_meta();
+ // 4. Fetch additional info about the emails
+ let query_scope = crit.query_scope();
+ let uuids = selection
+ .iter()
+ .map(|midx| midx.uuid)
+ .collect::<Vec<_>>();
+ let query_result = self.0.query(&uuids, query_scope).fetch().await?;
// 5. If needed, filter the selection based on the body
- let _need_body = crit.need_body();
+ let selection = crit.filter_on_query(&selection, &query_result);
// 6. Format the result according to the client's taste:
// either return UID or ID.