Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat: exclude spam from email search (#1653)

gbirman280c96acd289
diff --git a/rust/cloud-storage/opensearch_client/src/search/emails.rs b/rust/cloud-storage/opensearch_client/src/search/emails.rs
index 52771a9cbc..716348ef1a 100644
--- a/rust/cloud-storage/opensearch_client/src/search/emails.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/emails.rs
@@ -92,8 +92,9 @@ impl EmailQueryBuilder {
let mut content_bool_query = self.inner.build_content_bool_query()?;
// CUSTOM ATTRIBUTES SECTION
- // We don't want to include trash items in your email search
+ // We don't want to include trash or spam items in your email search
content_bool_query.must_not(QueryType::term("labels", "TRASH"));
+ content_bool_query.must_not(QueryType::term("labels", "SPAM"));
// If link_ids are provided, add them to the query
if !self.link_ids.is_empty() {
diff --git a/rust/cloud-storage/opensearch_client/src/search/emails/test.rs b/rust/cloud-storage/opensearch_client/src/search/emails/test.rs
index 0ac0fbb341..4dcd0ad4a9 100644
--- a/rust/cloud-storage/opensearch_client/src/search/emails/test.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/emails/test.rs
@@ -137,6 +137,11 @@ fn test_build_search_request() -> anyhow::Result<()> {
"term": {
"labels": "TRASH"
}
+ },
+ {
+ "term": {
+ "labels": "SPAM"
+ }
}
]
}
diff --git a/rust/cloud-storage/opensearch_client/src/search/unified/test.rs b/rust/cloud-storage/opensearch_client/src/search/unified/test.rs
index f77f94a639..0ea50248ba 100644
--- a/rust/cloud-storage/opensearch_client/src/search/unified/test.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/unified/test.rs
@@ -669,6 +669,11 @@ fn test_build_unified_search_request_content() -> anyhow::Result<()> {
"term": {
"labels": "TRASH"
}
+ },
+ {
+ "term": {
+ "labels": "SPAM"
+ }
}
]
}