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.

chore(search): remove projects search index (#2694)

gbirmanff0d828df97b
diff --git a/rust/cloud-storage/macro_db_client/src/entity_name.rs b/rust/cloud-storage/macro_db_client/src/entity_name.rs
index b0781c4367..f57568d77b 100644
--- a/rust/cloud-storage/macro_db_client/src/entity_name.rs
+++ b/rust/cloud-storage/macro_db_client/src/entity_name.rs
@@ -79,7 +79,7 @@ pub async fn get_entity_name_and_owner(
.fetch_one(db)
.await?
}
- _ => {
+ SearchEntityType::Projects => {
anyhow::bail!("entity type not supported");
}
};
diff --git a/rust/cloud-storage/models_opensearch/src/lib.rs b/rust/cloud-storage/models_opensearch/src/lib.rs
index f3de0202f3..18838dff19 100644
--- a/rust/cloud-storage/models_opensearch/src/lib.rs
+++ b/rust/cloud-storage/models_opensearch/src/lib.rs
@@ -3,7 +3,7 @@
//! This crate should never contain utoipa or any service-level models.
//! This is purely a crate containing models used for opensearch directly.
-/// Enum for all the search indices
+/// Enum for all the search indices in OpenSearch
#[derive(Debug, Clone, Hash, Eq, PartialEq, strum::Display, strum::EnumString, strum::AsRefStr)]
#[strum(serialize_all = "lowercase")]
pub enum SearchIndex {
@@ -16,13 +16,13 @@ pub enum SearchIndex {
/// The email index
#[strum(serialize = "emails_alias")]
Emails,
- /// The project index
- Projects,
/// The name index
Names,
}
-/// Enum for all entity search indices
+/// All searchable entity types across the system.
+/// Not all variants have a corresponding OpenSearch index — Projects
+/// are searched via Postgres only.
#[derive(
Debug,
Clone,
@@ -38,6 +38,35 @@ pub enum SearchIndex {
#[strum(serialize_all = "lowercase")]
#[serde(rename_all = "lowercase")]
pub enum SearchEntityType {
+ /// The channel entity type (has OpenSearch index)
+ Channels,
+ /// The chat entity type (has OpenSearch index)
+ Chats,
+ /// The document entity type (has OpenSearch index)
+ Documents,
+ /// The email entity type (has OpenSearch index)
+ Emails,
+ /// The project entity type (Postgres-only, no OpenSearch index)
+ Projects,
+}
+
+/// The subset of [`SearchEntityType`] that have a corresponding OpenSearch index.
+/// Projects are intentionally excluded — they are searched via Postgres only.
+#[derive(
+ Debug,
+ Clone,
+ Hash,
+ Eq,
+ PartialEq,
+ strum::Display,
+ strum::EnumString,
+ strum::AsRefStr,
+ serde::Serialize,
+ serde::Deserialize,
+)]
+#[strum(serialize_all = "lowercase")]
+#[serde(rename_all = "lowercase")]
+pub enum OpenSearchEntityType {
/// The channel index
Channels,
/// The chat index
@@ -46,32 +75,56 @@ pub enum SearchEntityType {
Documents,
/// The email index
Emails,
- /// The project index
- Projects,
}
-impl SearchEntityType {
+impl OpenSearchEntityType {
/// Returns the index name to use for OpenSearch queries.
- /// This may differ from the enum's string representation when using aliases.
pub fn index_name(&self) -> &'static str {
match self {
Self::Channels => "channels",
Self::Chats => "chats",
Self::Documents => "documents",
Self::Emails => "emails_alias",
- Self::Projects => "projects",
}
}
}
-impl From<SearchEntityType> for SearchIndex {
- fn from(value: SearchEntityType) -> Self {
+impl From<OpenSearchEntityType> for SearchEntityType {
+ fn from(value: OpenSearchEntityType) -> Self {
+ match value {
+ OpenSearchEntityType::Channels => SearchEntityType::Channels,
+ OpenSearchEntityType::Chats => SearchEntityType::Chats,
+ OpenSearchEntityType::Documents => SearchEntityType::Documents,
+ OpenSearchEntityType::Emails => SearchEntityType::Emails,
+ }
+ }
+}
+
+impl From<OpenSearchEntityType> for SearchIndex {
+ fn from(value: OpenSearchEntityType) -> Self {
match value {
- SearchEntityType::Channels => SearchIndex::Channels,
- SearchEntityType::Chats => SearchIndex::Chats,
- SearchEntityType::Documents => SearchIndex::Documents,
- SearchEntityType::Emails => SearchIndex::Emails,
- SearchEntityType::Projects => SearchIndex::Projects,
+ OpenSearchEntityType::Channels => SearchIndex::Channels,
+ OpenSearchEntityType::Chats => SearchIndex::Chats,
+ OpenSearchEntityType::Documents => SearchIndex::Documents,
+ OpenSearchEntityType::Emails => SearchIndex::Emails,
+ }
+ }
+}
+
+#[cfg(test)]
+mod test {
+ use super::*;
+
+ #[test]
+ fn index_name_matches_search_index() {
+ for variant in [
+ OpenSearchEntityType::Channels,
+ OpenSearchEntityType::Chats,
+ OpenSearchEntityType::Documents,
+ OpenSearchEntityType::Emails,
+ ] {
+ let from_index: SearchIndex = variant.clone().into();
+ assert_eq!(variant.index_name(), from_index.as_ref());
}
}
}
diff --git a/rust/cloud-storage/opensearch_client/examples/unified_opensearch_query.rs b/rust/cloud-storage/opensearch_client/examples/unified_opensearch_query.rs
index b51b18a49e..613a45071e 100644
--- a/rust/cloud-storage/opensearch_client/examples/unified_opensearch_query.rs
+++ b/rust/cloud-storage/opensearch_client/examples/unified_opensearch_query.rs
@@ -1,6 +1,6 @@
use std::collections::HashSet;
-use models_opensearch::SearchEntityType;
+use models_opensearch::OpenSearchEntityType;
use models_search_cursor::SearchCursorOption;
use opensearch_client::search::unified::{UnifiedEmailSearchArgs, UnifiedSearchArgs};
@@ -12,7 +12,7 @@ fn main() {
match_type: "partial".to_string(),
collapse: false,
cursor: SearchCursorOption::NotDone(None),
- search_indices: HashSet::from([SearchEntityType::Emails]),
+ search_indices: HashSet::from([OpenSearchEntityType::Emails]),
email_search_args: UnifiedEmailSearchArgs {
terms: vec!["hello re".to_string()],
..Default::default()
diff --git a/rust/cloud-storage/opensearch_client/src/delete/name.rs b/rust/cloud-storage/opensearch_client/src/delete/name.rs
index a337e69b42..2667d024f1 100644
--- a/rust/cloud-storage/opensearch_client/src/delete/name.rs
+++ b/rust/cloud-storage/opensearch_client/src/delete/name.rs
@@ -1,12 +1,12 @@
use crate::{Result, error::ResponseExt};
-use models_opensearch::{SearchEntityType, SearchIndex};
+use models_opensearch::{OpenSearchEntityType, SearchIndex};
/// Deletes all name documents with the specified entity_id and entity_type
#[tracing::instrument(skip(client))]
pub async fn delete_entity_name(
client: &opensearch::OpenSearch,
entity_id: &str,
- entity_type: &SearchEntityType,
+ entity_type: &OpenSearchEntityType,
) -> Result<()> {
let query = serde_json::json!({
"query": {
@@ -45,7 +45,7 @@ pub async fn delete_entity_name(
pub async fn delete_entity_name_bulk(
client: &opensearch::OpenSearch,
entity_ids: &[String],
- entity_type: &SearchEntityType,
+ entity_type: &OpenSearchEntityType,
) -> Result<()> {
let query = serde_json::json!({
"query": {
@@ -119,7 +119,7 @@ pub async fn delete_entity_name_bulk_for_user(
pub async fn delete_entity_name_bulk_for_user_by_entity_type(
client: &opensearch::OpenSearch,
user_id: &str,
- entity_type: &SearchEntityType,
+ entity_type: &OpenSearchEntityType,
) -> Result<()> {
let query = serde_json::json!({
"query": {
diff --git a/rust/cloud-storage/opensearch_client/src/error.rs b/rust/cloud-storage/opensearch_client/src/error.rs
index 4d13a342cc..c043834458 100644
--- a/rust/cloud-storage/opensearch_client/src/error.rs
+++ b/rust/cloud-storage/opensearch_client/src/error.rs
@@ -1,4 +1,4 @@
-use models_opensearch::SearchEntityType;
+use models_opensearch::OpenSearchEntityType;
use opensearch::{Error, http::response::Response};
#[derive(thiserror::Error, Debug, serde::Serialize, PartialEq)]
@@ -50,7 +50,7 @@ pub enum OpensearchClientError {
BoolQueryNotBuilt,
#[error("empty ids with ids only for {0}")]
- EmptyIdsWithIdsOnly(SearchEntityType),
+ EmptyIdsWithIdsOnly(OpenSearchEntityType),
#[error("searching with exhausted cursor")]
SearchWithExhaustedCursor,
diff --git a/rust/cloud-storage/opensearch_client/src/name.rs b/rust/cloud-storage/opensearch_client/src/name.rs
index 69b7132128..cc0672c02b 100644
--- a/rust/cloud-storage/opensearch_client/src/name.rs
+++ b/rust/cloud-storage/opensearch_client/src/name.rs
@@ -1,4 +1,4 @@
-use models_opensearch::SearchEntityType;
+use models_opensearch::OpenSearchEntityType;
use crate::{
OpensearchClient, Result,
@@ -21,7 +21,7 @@ impl OpensearchClient {
pub async fn delete_entity_name(
&self,
entity_id: &str,
- entity_type: &SearchEntityType,
+ entity_type: &OpenSearchEntityType,
) -> Result<()> {
delete_entity_name(&self.inner, entity_id, entity_type).await
}
@@ -31,7 +31,7 @@ impl OpensearchClient {
pub async fn delete_entity_names_bulk(
&self,
entity_ids: &[String],
- entity_type: &SearchEntityType,
+ entity_type: &OpenSearchEntityType,
) -> Result<()> {
delete_entity_name_bulk(&self.inner, entity_ids, entity_type).await
}
@@ -47,7 +47,7 @@ impl OpensearchClient {
pub async fn delete_entities_for_user_by_entity_type(
&self,
user_id: &str,
- entity_type: &SearchEntityType,
+ entity_type: &OpenSearchEntityType,
) -> Result<()> {
delete_entity_name_bulk_for_user_by_entity_type(&self.inner, user_id, entity_type).await
}
diff --git a/rust/cloud-storage/opensearch_client/src/search/builder.rs b/rust/cloud-storage/opensearch_client/src/search/builder.rs
index c29be6befc..40ef97375b 100644
--- a/rust/cloud-storage/opensearch_client/src/search/builder.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/builder.rs
@@ -4,7 +4,7 @@ use crate::Result;
use crate::error::OpensearchClientError;
use crate::search::query::QueryKey;
use crate::search::query::generate_terms_must_query;
-use models_opensearch::SearchEntityType;
+use models_opensearch::OpenSearchEntityType;
use models_search_cursor::SearchMethodCursor;
use opensearch_query_builder::{
BoolQueryBuilder, FieldSort, QueryType, Script, ScriptSort, ScriptSortType, SortOrder, SortType,
@@ -83,7 +83,7 @@ pub trait SearchQueryConfig {
/// Content field
const CONTENT_KEY: &'static str = "content";
/// The entity index for the search query
- const ENTITY_INDEX: SearchEntityType;
+ const ENTITY_INDEX: OpenSearchEntityType;
}
#[derive(Default)]
diff --git a/rust/cloud-storage/opensearch_client/src/search/builder/test.rs b/rust/cloud-storage/opensearch_client/src/search/builder/test.rs
index cd443e0fde..9089cc7f38 100644
--- a/rust/cloud-storage/opensearch_client/src/search/builder/test.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/builder/test.rs
@@ -7,7 +7,7 @@ struct TestSearchConfig;
impl SearchQueryConfig for TestSearchConfig {
const USER_ID_KEY: &'static str = "test_user_id";
const TITLE_KEY: &'static str = "test_title";
- const ENTITY_INDEX: SearchEntityType = SearchEntityType::Documents;
+ const ENTITY_INDEX: OpenSearchEntityType = OpenSearchEntityType::Documents;
}
#[test]
@@ -109,7 +109,7 @@ fn test_build_contentquery_empty_ids() -> anyhow::Result<()> {
let error = builder.build_content_bool_query().err().unwrap();
assert_eq!(
- OpensearchClientError::EmptyIdsWithIdsOnly(SearchEntityType::Documents),
+ OpensearchClientError::EmptyIdsWithIdsOnly(OpenSearchEntityType::Documents),
error
);
diff --git a/rust/cloud-storage/opensearch_client/src/search/channels.rs b/rust/cloud-storage/opensearch_client/src/search/channels.rs
index e225d79fd8..7b86cac6d0 100644
--- a/rust/cloud-storage/opensearch_client/src/search/channels.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/channels.rs
@@ -3,7 +3,7 @@ use crate::{
search::builder::{SearchQueryBuilder, SearchQueryConfig},
};
-use models_opensearch::SearchEntityType;
+use models_opensearch::OpenSearchEntityType;
use opensearch_query_builder::{BoolQueryBuilder, QueryType};
#[derive(Debug, serde::Serialize, serde::Deserialize)]
@@ -25,7 +25,7 @@ pub(crate) struct ChannelMessageSearchConfig;
impl SearchQueryConfig for ChannelMessageSearchConfig {
const USER_ID_KEY: &'static str = "sender_id";
const TITLE_KEY: &'static str = "name";
- const ENTITY_INDEX: SearchEntityType = SearchEntityType::Channels;
+ const ENTITY_INDEX: OpenSearchEntityType = OpenSearchEntityType::Channels;
}
#[derive(Default)]
diff --git a/rust/cloud-storage/opensearch_client/src/search/chats.rs b/rust/cloud-storage/opensearch_client/src/search/chats.rs
index 67b9b327f8..64280ac983 100644
--- a/rust/cloud-storage/opensearch_client/src/search/chats.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/chats.rs
@@ -6,7 +6,7 @@ use crate::{
},
};
-use models_opensearch::SearchEntityType;
+use models_opensearch::OpenSearchEntityType;
use opensearch_query_builder::BoolQueryBuilder;
#[derive(Debug, serde::Serialize, serde::Deserialize)]
@@ -24,7 +24,7 @@ pub(crate) struct ChatSearchConfig;
impl SearchQueryConfig for ChatSearchConfig {
const USER_ID_KEY: &'static str = "user_id";
const TITLE_KEY: &'static str = "name";
- const ENTITY_INDEX: SearchEntityType = SearchEntityType::Chats;
+ const ENTITY_INDEX: OpenSearchEntityType = OpenSearchEntityType::Chats;
}
pub(crate) struct ChatQueryBuilder {
diff --git a/rust/cloud-storage/opensearch_client/src/search/documents.rs b/rust/cloud-storage/opensearch_client/src/search/documents.rs
index 0034058855..370bac7ae5 100644
--- a/rust/cloud-storage/opensearch_client/src/search/documents.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/documents.rs
@@ -3,7 +3,7 @@ use crate::{
search::builder::{SearchQueryBuilder, SearchQueryConfig},
};
-use models_opensearch::SearchEntityType;
+use models_opensearch::OpenSearchEntityType;
use opensearch_query_builder::{BoolQueryBuilder, QueryType};
#[derive(Clone)]
@@ -12,7 +12,7 @@ pub(crate) struct DocumentSearchConfig;
impl SearchQueryConfig for DocumentSearchConfig {
const USER_ID_KEY: &'static str = "owner_id";
const TITLE_KEY: &'static str = "name";
- const ENTITY_INDEX: SearchEntityType = SearchEntityType::Documents;
+ const ENTITY_INDEX: OpenSearchEntityType = OpenSearchEntityType::Documents;
}
pub(crate) struct DocumentQueryBuilder {
diff --git a/rust/cloud-storage/opensearch_client/src/search/emails.rs b/rust/cloud-storage/opensearch_client/src/search/emails.rs
index 03de3f2f75..881277782a 100644
--- a/rust/cloud-storage/opensearch_client/src/search/emails.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/emails.rs
@@ -6,7 +6,7 @@ use crate::{
},
};
-use models_opensearch::SearchEntityType;
+use models_opensearch::OpenSearchEntityType;
use opensearch_query_builder::{BoolQuery, BoolQueryBuilder, QueryType, SimpleQueryStringQuery};
pub(crate) struct EmailSearchConfig;
@@ -14,7 +14,7 @@ pub(crate) struct EmailSearchConfig;
impl SearchQueryConfig for EmailSearchConfig {
const USER_ID_KEY: &'static str = "user_id";
const TITLE_KEY: &'static str = "subject";
- const ENTITY_INDEX: SearchEntityType = SearchEntityType::Emails;
+ const ENTITY_INDEX: OpenSearchEntityType = OpenSearchEntityType::Emails;
}
/// The fields to search across with simple_query_string for email search.
diff --git a/rust/cloud-storage/opensearch_client/src/search/unified.rs b/rust/cloud-storage/opensearch_client/src/search/unified.rs
index cc24fe3b82..9254489f24 100644
--- a/rust/cloud-storage/opensearch_client/src/search/unified.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/unified.rs
@@ -26,7 +26,7 @@ use chrono::{DateTime, Utc};
use models_search_cursor::{SearchCursorOption, SearchMethodCursor};
use tracing::Instrument;
-use models_opensearch::SearchEntityType;
+use models_opensearch::{OpenSearchEntityType, SearchEntityType};
use opensearch_query_builder::*;
impl UnifiedSearchArgs {
@@ -49,7 +49,7 @@ pub struct UnifiedSearchArgs {
/// The cursor to use
pub cursor: SearchCursorOption,
/// The indices to search over
- pub search_indices: HashSet<SearchEntityType>,
+ pub search_indices: HashSet<OpenSearchEntityType>,
/// The document search args
pub document_search_args: UnifiedDocumentSearchArgs,
/// The email search args. If None, we do not search emails
@@ -365,7 +365,10 @@ fn build_unified_search_request(args: &UnifiedSearchArgs) -> Result<SearchReques
// There will always be 1 query as the indices are never empty
bool_query.minimum_should_match(1);
- if args.search_indices.contains(&SearchEntityType::Documents) {
+ if args
+ .search_indices
+ .contains(&OpenSearchEntityType::Documents)
+ {
let document_search_args: DocumentSearchArgs = args.clone().into();
let document_query_builder: DocumentQueryBuilder = document_search_args.into();
let document_bool_query = document_query_builder.build_bool_query()?;
@@ -373,7 +376,7 @@ fn build_unified_search_request(args: &UnifiedSearchArgs) -> Result<SearchReques
bool_query.should(query_type.to_owned());
}
- if args.search_indices.contains(&SearchEntityType::Emails) {
+ if args.search_indices.contains(&OpenSearchEntityType::Emails) {
let email_search_args: EmailSearchArgs = args.clone().into();
let email_query_builder: EmailQueryBuilder = email_search_args.into();
let email_bool_query = email_query_builder.build_bool_query()?;
@@ -381,7 +384,10 @@ fn build_unified_search_request(args: &UnifiedSearchArgs) -> Result<SearchReques
bool_query.should(query_type.to_owned());
}
- if args.search_indices.contains(&SearchEntityType::Channels) {
+ if args
+ .search_indices
+ .contains(&OpenSearchEntityType::Channels)
+ {
let channel_message_search_args: ChannelMessageSearchArgs = args.clone().into();
let channel_message_query_builder: ChannelMessageQueryBuilder =
channel_message_search_args.into();
@@ -390,7 +396,7 @@ fn build_unified_search_request(args: &UnifiedSearchArgs) -> Result<SearchReques
bool_query.should(query_type.to_owned());
}
- if args.search_indices.contains(&SearchEntityType::Chats) {
+ if args.search_indices.contains(&OpenSearchEntityType::Chats) {
let chat_search_args: ChatSearchArgs = args.clone().into();
let chat_query_builder: ChatQueryBuilder = chat_search_args.into();
let chat_bool_query = chat_query_builder.build_bool_query()?;
@@ -459,18 +465,7 @@ pub(crate) async fn search_unified(
tracing::trace!("search request {:?}", search_request);
- // We cannot search over the projects index in opensearch as it doesn't exist
- let search_indices: Vec<&str> = args
- .search_indices
- .iter()
- .filter(|i| **i != SearchEntityType::Projects)
- .map(|i| i.index_name())
- .collect();
-
- // After we filter out invalid search entities if we have nothing we should return that the cursor is exhausted
- if search_indices.is_empty() {
- return Ok((Vec::new(), SearchCursorOption::Done));
- }
+ let search_indices: Vec<&str> = args.search_indices.iter().map(|i| i.index_name()).collect();
let response = async {
client
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 adb7406152..92fb740454 100644
--- a/rust/cloud-storage/opensearch_client/src/search/unified/test.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/unified/test.rs
@@ -407,11 +407,10 @@ fn test_build_unified_search_request_content() -> anyhow::Result<()> {
let unified_search_args = UnifiedSearchArgs {
search_indices: vec![
- SearchEntityType::Documents,
- SearchEntityType::Emails,
- SearchEntityType::Projects,
- SearchEntityType::Channels,
- SearchEntityType::Chats,
+ OpenSearchEntityType::Documents,
+ OpenSearchEntityType::Emails,
+ OpenSearchEntityType::Channels,
+ OpenSearchEntityType::Chats,
]
.into_iter()
.collect(),
@@ -779,11 +778,10 @@ fn test_build_unified_search_request_content() -> anyhow::Result<()> {
let unified_search_args = UnifiedSearchArgs {
search_indices: vec![
- SearchEntityType::Documents,
- SearchEntityType::Emails,
- SearchEntityType::Projects,
- SearchEntityType::Channels,
- SearchEntityType::Chats,
+ OpenSearchEntityType::Documents,
+ OpenSearchEntityType::Emails,
+ OpenSearchEntityType::Channels,
+ OpenSearchEntityType::Chats,
]
.into_iter()
.collect(),
@@ -838,7 +836,7 @@ fn test_build_unified_search_request_content() -> anyhow::Result<()> {
#[test]
fn test_build_unified_search_request_single_index() -> anyhow::Result<()> {
let unified_search_args = UnifiedSearchArgs {
- search_indices: vec![SearchEntityType::Documents].into_iter().collect(),
+ search_indices: vec![OpenSearchEntityType::Documents].into_iter().collect(),
user_id: "user".to_string(),
page: 1,
page_size: 20,
diff --git a/rust/cloud-storage/opensearch_client/src/upsert/name.rs b/rust/cloud-storage/opensearch_client/src/upsert/name.rs
index 6b0ff0b0a8..c93b8650f2 100644
--- a/rust/cloud-storage/opensearch_client/src/upsert/name.rs
+++ b/rust/cloud-storage/opensearch_client/src/upsert/name.rs
@@ -1,6 +1,6 @@
//! This module handles the upserting of entity names into the opensearch index
-use models_opensearch::{SearchEntityType, SearchIndex};
+use models_opensearch::{OpenSearchEntityType, SearchIndex};
use crate::{Result, error::ResponseExt};
@@ -14,7 +14,7 @@ pub struct UpsertEntityNameArgs {
/// The entity name
pub name: String,
/// The entity type
- pub entity_type: SearchEntityType,
+ pub entity_type: OpenSearchEntityType,
}
#[tracing::instrument(skip(client), err)]
diff --git a/rust/cloud-storage/search_processing_service/src/process/chat.rs b/rust/cloud-storage/search_processing_service/src/process/chat.rs
index 33775cfb9f..5cd3083a19 100644
--- a/rust/cloud-storage/search_processing_service/src/process/chat.rs
+++ b/rust/cloud-storage/search_processing_service/src/process/chat.rs
@@ -1,5 +1,5 @@
use anyhow::Context;
-use models_opensearch::SearchEntityType;
+use models_opensearch::OpenSearchEntityType;
use opensearch_client::{
OpensearchClient, date_format::EpochSeconds, upsert::chat_message::UpsertChatMessageArgs,
};
@@ -57,7 +57,10 @@ pub async fn remove_chat_message(
.await?;
opensearch_client
- .delete_entity_name(remove_message.chat_id.as_str(), &SearchEntityType::Chats)
+ .delete_entity_name(
+ remove_message.chat_id.as_str(),
+ &OpenSearchEntityType::Chats,
+ )
.await?;
}
diff --git a/rust/cloud-storage/search_processing_service/src/process/document/mod.rs b/rust/cloud-storage/search_processing_service/src/process/document/mod.rs
index 50529a7bc7..139d71ce58 100644
--- a/rust/cloud-storage/search_processing_service/src/process/document/mod.rs
+++ b/rust/cloud-storage/search_processing_service/src/process/document/mod.rs
@@ -1,6 +1,6 @@
use anyhow::Context;
use model::document::FileTypeExt;
-use models_opensearch::SearchEntityType;
+use models_opensearch::OpenSearchEntityType;
use opensearch_client::OpensearchClient;
use sqs_client::search::document::{DocumentId, SearchExtractorMessage};
@@ -18,7 +18,7 @@ pub async fn process_remove_message(
opensearch_client
.delete_entity_name(
remove_message.document_id.as_str(),
- &SearchEntityType::Documents,
+ &OpenSearchEntityType::Documents,
)
.await?;
diff --git a/rust/cloud-storage/search_processing_service/src/process/email/remove.rs b/rust/cloud-storage/search_processing_service/src/process/email/remove.rs
index 8df0825449..4c456eca10 100644
--- a/rust/cloud-storage/search_processing_service/src/process/email/remove.rs
+++ b/rust/cloud-storage/search_processing_service/src/process/email/remove.rs
@@ -1,4 +1,4 @@
-use models_opensearch::SearchEntityType;
+use models_opensearch::OpenSearchEntityType;
use opensearch_client::OpensearchClient;
use sqs_client::search::email::{EmailLinkMessage, EmailMessage};
@@ -24,7 +24,7 @@ pub async fn process_remove_messages_by_link_id(
opensearch_client
.delete_entities_for_user_by_entity_type(
remove_link_message.macro_user_id.as_str(),
- &SearchEntityType::Emails,
+ &OpenSearchEntityType::Emails,
)
.await?;
diff --git a/rust/cloud-storage/search_service/src/api/search/simple/simple_unified.rs b/rust/cloud-storage/search_service/src/api/search/simple/simple_unified.rs
index f2a2a25ecf..85a0b75f75 100644
--- a/rust/cloud-storage/search_service/src/api/search/simple/simple_unified.rs
+++ b/rust/cloud-storage/search_service/src/api/search/simple/simple_unified.rs
@@ -266,21 +266,18 @@ pub(in crate::api::search) async fn perform_unified_search(
&& !(filter_document_response.ids_only
&& filter_document_response.document_ids.is_empty())
{
- indices.insert(models_opensearch::SearchEntityType::Documents);
+ indices.insert(models_opensearch::OpenSearchEntityType::Documents);
}
if should_include_chats
&& !(filter_chat_response.ids_only && filter_chat_response.chat_ids.is_empty())
{
- indices.insert(models_opensearch::SearchEntityType::Chats);
+ indices.insert(models_opensearch::OpenSearchEntityType::Chats);
}
if should_include_emails {
- indices.insert(models_opensearch::SearchEntityType::Emails);
+ indices.insert(models_opensearch::OpenSearchEntityType::Emails);
}
if should_include_channels && !filter_channel_response.channel_ids.is_empty() {
- indices.insert(models_opensearch::SearchEntityType::Channels);
- }
- if should_include_projects {
- indices.insert(models_opensearch::SearchEntityType::Projects);
+ indices.insert(models_opensearch::OpenSearchEntityType::Channels);
}
indices
},
@@ -368,7 +365,7 @@ pub(in crate::api::search) async fn perform_unified_search(
let mut args = unified_search_args;
if matches!(search_on, SearchOn::Name) {
args.search_indices
- .retain(|i| *i == models_opensearch::SearchEntityType::Emails);
+ .retain(|i| *i == models_opensearch::OpenSearchEntityType::Emails);
args.email_search_args.subject_only = true;
}
if args.search_indices.is_empty() {