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(search_service) sort by hit score after combining enriched results (#241)

Will Hutchinsona5fec739a775
diff --git a/rust/cloud-storage/models_search/src/channel.rs b/rust/cloud-storage/models_search/src/channel.rs
index 183e89c469..e80bf7a6a4 100644
--- a/rust/cloud-storage/models_search/src/channel.rs
+++ b/rust/cloud-storage/models_search/src/channel.rs
@@ -19,6 +19,9 @@ pub struct ChannelSearchResult {
pub created_at: i64,
/// When the channel message was last updated
pub updated_at: i64,
+ /// The score of the result
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub score: Option<f64>,
}
/// A single response item, part of the ChannelSearchResponse object
diff --git a/rust/cloud-storage/models_search/src/chat.rs b/rust/cloud-storage/models_search/src/chat.rs
index 29a915ce55..4ab87dbe64 100644
--- a/rust/cloud-storage/models_search/src/chat.rs
+++ b/rust/cloud-storage/models_search/src/chat.rs
@@ -18,6 +18,9 @@ pub struct ChatMessageSearchResult {
pub updated_at: i64,
/// The title of the chat
pub title: String,
+ /// The score of the result
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub score: Option<f64>,
}
/// A single response item, part of the ChatSearchResponse object
diff --git a/rust/cloud-storage/models_search/src/chat/test.rs b/rust/cloud-storage/models_search/src/chat/test.rs
index 3745186872..886dd7e46d 100644
--- a/rust/cloud-storage/models_search/src/chat/test.rs
+++ b/rust/cloud-storage/models_search/src/chat/test.rs
@@ -218,6 +218,7 @@ fn test_search_response_item_to_chat_response_item_with_metadata() {
highlight: SearchHighlight::default(),
updated_at: 1234567890,
title: "Test".to_string(),
+ score: None,
},
ChatMessageSearchResult {
chat_message_id: "msg_2".to_string(),
@@ -225,6 +226,7 @@ fn test_search_response_item_to_chat_response_item_with_metadata() {
highlight: SearchHighlight::default(),
updated_at: 1234567891,
title: "Test".to_string(),
+ score: None,
},
],
metadata: ChatSearchMetadata {
@@ -267,6 +269,7 @@ fn test_serialization_equivalence() {
highlight: SearchHighlight::default(),
updated_at: 1234567890,
title: "Test Chat".to_string(),
+ score: None,
}],
};
@@ -278,6 +281,7 @@ fn test_serialization_equivalence() {
highlight: SearchHighlight::default(),
updated_at: 1234567890,
title: "Test Chat".to_string(),
+ score: None,
}],
metadata: ChatSearchMetadata {
chat_id: "chat_123".to_string(),
diff --git a/rust/cloud-storage/models_search/src/document.rs b/rust/cloud-storage/models_search/src/document.rs
index 9bbddcf8ae..967c2f7cbb 100644
--- a/rust/cloud-storage/models_search/src/document.rs
+++ b/rust/cloud-storage/models_search/src/document.rs
@@ -18,6 +18,9 @@ pub struct DocumentSearchResult {
pub raw_content: Option<String>,
/// When the search document was last updated
pub updated_at: i64,
+ /// The score of the result
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub score: Option<f64>,
}
/// A single response item, part of the DocumentSearchResponse object
diff --git a/rust/cloud-storage/models_search/src/email.rs b/rust/cloud-storage/models_search/src/email.rs
index d20b98cf80..b2ea83cc81 100644
--- a/rust/cloud-storage/models_search/src/email.rs
+++ b/rust/cloud-storage/models_search/src/email.rs
@@ -21,6 +21,9 @@ pub struct EmailSearchResult {
pub updated_at: i64,
/// When the email message was sent
pub sent_at: Option<i64>,
+ /// The score of the result
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub score: Option<f64>,
}
/// A single response item, part of the EmailSearchResponse object
diff --git a/rust/cloud-storage/models_search/src/lib.rs b/rust/cloud-storage/models_search/src/lib.rs
index b4b8ae8757..2210349ea1 100644
--- a/rust/cloud-storage/models_search/src/lib.rs
+++ b/rust/cloud-storage/models_search/src/lib.rs
@@ -8,6 +8,7 @@ pub mod chat;
pub mod document;
pub mod email;
pub mod project;
+pub mod score;
pub mod timestamp;
pub mod unified;
diff --git a/rust/cloud-storage/models_search/src/project.rs b/rust/cloud-storage/models_search/src/project.rs
index 6828db0e21..303437915c 100644
--- a/rust/cloud-storage/models_search/src/project.rs
+++ b/rust/cloud-storage/models_search/src/project.rs
@@ -7,6 +7,9 @@ use utoipa::ToSchema;
#[derive(Debug, Serialize, Deserialize, ToSchema)]
pub struct ProjectSearchResult {
pub highlight: SearchHighlight,
+ /// The score of the result
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub score: Option<f64>,
}
/// Metadata associated with Project Search, to be used with SearchResponseItem
diff --git a/rust/cloud-storage/models_search/src/score.rs b/rust/cloud-storage/models_search/src/score.rs
new file mode 100644
index 0000000000..50e5a19d34
--- /dev/null
+++ b/rust/cloud-storage/models_search/src/score.rs
@@ -0,0 +1,49 @@
+use crate::{
+ channel::ChannelSearchResult, chat::ChatMessageSearchResult, document::DocumentSearchResult,
+ email::EmailSearchResult, project::ProjectSearchResult,
+};
+
+/// Trait to grab the score from an item
+pub trait HasScore {
+ /// Get the score for this item
+ fn score(&self) -> Option<f64>;
+}
+
+impl HasScore for DocumentSearchResult {
+ fn score(&self) -> Option<f64> {
+ self.score
+ }
+}
+
+impl HasScore for ChatMessageSearchResult {
+ fn score(&self) -> Option<f64> {
+ self.score
+ }
+}
+
+impl HasScore for EmailSearchResult {
+ fn score(&self) -> Option<f64> {
+ self.score
+ }
+}
+
+impl HasScore for ProjectSearchResult {
+ fn score(&self) -> Option<f64> {
+ self.score
+ }
+}
+
+impl HasScore for ChannelSearchResult {
+ fn score(&self) -> Option<f64> {
+ self.score
+ }
+}
+
+/// Helper function to calculate average score
+pub fn calculate_average(results: &[impl HasScore]) -> f64 {
+ if results.is_empty() {
+ return 0.0;
+ }
+ let sum: f64 = results.iter().map(|r| r.score().unwrap_or(0.0)).sum();
+ sum / results.len() as f64
+}
diff --git a/rust/cloud-storage/models_search/src/unified.rs b/rust/cloud-storage/models_search/src/unified.rs
index b6a61acf6e..aafdad0278 100644
--- a/rust/cloud-storage/models_search/src/unified.rs
+++ b/rust/cloud-storage/models_search/src/unified.rs
@@ -5,6 +5,7 @@ use crate::chat::ChatSearchResponseItemWithMetadata;
use crate::document::DocumentSearchResponseItemWithMetadata;
use crate::email::EmailSearchResponseItemWithMetadata;
use crate::project::ProjectSearchResponseItemWithMetadata;
+use crate::score::calculate_average;
use crate::{
MatchType, SearchOn, channel::SimpleChannelSearchReponseBaseItem,
chat::SimpleChatSearchResponseBaseItem, document::SimpleDocumentSearchResponseBaseItem,
@@ -130,6 +131,19 @@ pub enum UnifiedSearchResponseItem {
Project(ProjectSearchResponseItemWithMetadata),
}
+impl UnifiedSearchResponseItem {
+ /// Calculate the average score from search_results
+ pub fn average_score(&self) -> f64 {
+ match self {
+ Self::Document(item) => calculate_average(&item.extra.document_search_results),
+ Self::Chat(item) => calculate_average(&item.extra.chat_search_results),
+ Self::Email(item) => calculate_average(&item.extra.email_message_search_results),
+ Self::Channel(item) => calculate_average(&item.extra.channel_message_search_results),
+ Self::Project(item) => calculate_average(&item.extra.project_search_results),
+ }
+ }
+}
+
#[derive(Debug, Serialize, Deserialize, ToSchema, Default)]
pub struct UnifiedSearchResponse {
pub results: Vec<UnifiedSearchResponseItem>,
diff --git a/rust/cloud-storage/opensearch_client/src/search/channels.rs b/rust/cloud-storage/opensearch_client/src/search/channels.rs
index d403a2e5f2..57f03c3bef 100644
--- a/rust/cloud-storage/opensearch_client/src/search/channels.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/channels.rs
@@ -42,6 +42,8 @@ pub struct ChannelMessageSearchResponse {
pub mentions: Vec<String>,
pub created_at: i64,
pub updated_at: i64,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub score: Option<f64>,
/// Contains the highlight matches for the channel name and content
pub highlight: Highlight,
}
@@ -216,16 +218,17 @@ pub(crate) async fn search_channel_messages(
.hits
.into_iter()
.map(|hit| ChannelMessageSearchResponse {
- channel_id: hit._source.entity_id,
- channel_name: hit._source.channel_name,
- channel_type: hit._source.channel_type,
- org_id: hit._source.org_id,
- message_id: hit._source.message_id,
- thread_id: hit._source.thread_id,
- sender_id: hit._source.sender_id,
- mentions: hit._source.mentions,
- created_at: hit._source.created_at_seconds,
- updated_at: hit._source.updated_at_seconds,
+ channel_id: hit.source.entity_id,
+ channel_name: hit.source.channel_name,
+ channel_type: hit.source.channel_type,
+ org_id: hit.source.org_id,
+ message_id: hit.source.message_id,
+ thread_id: hit.source.thread_id,
+ sender_id: hit.source.sender_id,
+ mentions: hit.source.mentions,
+ created_at: hit.source.created_at_seconds,
+ updated_at: hit.source.updated_at_seconds,
+ score: hit.score,
highlight: hit
.highlight
.map(|h| {
diff --git a/rust/cloud-storage/opensearch_client/src/search/chats.rs b/rust/cloud-storage/opensearch_client/src/search/chats.rs
index d1ed2d4270..f8d0519460 100644
--- a/rust/cloud-storage/opensearch_client/src/search/chats.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/chats.rs
@@ -35,6 +35,7 @@ pub struct ChatSearchResponse {
pub role: String,
pub updated_at: i64,
pub title: String,
+ pub score: Option<f64>,
pub highlight: Highlight,
}
@@ -180,11 +181,12 @@ pub(crate) async fn search_chats(
.hits
.into_iter()
.map(|hit| ChatSearchResponse {
- chat_id: hit._source.entity_id,
- chat_message_id: hit._source.chat_message_id,
- user_id: hit._source.user_id,
- role: hit._source.role,
- title: hit._source.title,
+ chat_id: hit.source.entity_id,
+ chat_message_id: hit.source.chat_message_id,
+ user_id: hit.source.user_id,
+ role: hit.source.role,
+ title: hit.source.title,
+ score: hit.score,
highlight: hit
.highlight
.map(|h| {
@@ -197,7 +199,7 @@ pub(crate) async fn search_chats(
)
})
.unwrap_or_default(),
- updated_at: hit._source.updated_at_seconds,
+ updated_at: hit.source.updated_at_seconds,
})
.collect())
}
diff --git a/rust/cloud-storage/opensearch_client/src/search/documents.rs b/rust/cloud-storage/opensearch_client/src/search/documents.rs
index 04a3413018..c308f7532b 100644
--- a/rust/cloud-storage/opensearch_client/src/search/documents.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/documents.rs
@@ -95,6 +95,7 @@ pub struct DocumentSearchResponse {
/// Contains the highlight matches for the document name and content
pub highlight: Highlight,
pub raw_content: Option<String>,
+ pub score: Option<f64>,
}
#[derive(Debug)]
@@ -163,13 +164,14 @@ pub(crate) async fn search_documents(
.hits
.into_iter()
.map(|hit| DocumentSearchResponse {
- document_id: hit._source.entity_id,
- node_id: hit._source.node_id,
- document_name: hit._source.document_name,
- owner_id: hit._source.owner_id,
- file_type: hit._source.file_type,
- updated_at: hit._source.updated_at_seconds,
- raw_content: hit._source.raw_content,
+ document_id: hit.source.entity_id,
+ node_id: hit.source.node_id,
+ document_name: hit.source.document_name,
+ owner_id: hit.source.owner_id,
+ file_type: hit.source.file_type,
+ updated_at: hit.source.updated_at_seconds,
+ raw_content: hit.source.raw_content,
+ score: hit.score,
highlight: hit
.highlight
.map(|h| {
diff --git a/rust/cloud-storage/opensearch_client/src/search/emails.rs b/rust/cloud-storage/opensearch_client/src/search/emails.rs
index 0793d6f0c4..3cd4d7ef16 100644
--- a/rust/cloud-storage/opensearch_client/src/search/emails.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/emails.rs
@@ -192,6 +192,7 @@ pub struct EmailSearchResponse {
pub updated_at: i64,
pub sent_at: Option<i64>,
pub subject: Option<String>,
+ pub score: Option<f64>,
pub highlight: Highlight,
}
@@ -268,18 +269,19 @@ pub(crate) async fn search_emails(
.hits
.into_iter()
.map(|hit| EmailSearchResponse {
- thread_id: hit._source.entity_id,
- message_id: hit._source.message_id,
- subject: hit._source.subject,
- sender: hit._source.sender,
- recipients: hit._source.recipients,
- cc: hit._source.cc,
- bcc: hit._source.bcc,
- labels: hit._source.labels,
- link_id: hit._source.link_id,
- user_id: hit._source.user_id,
- updated_at: hit._source.updated_at_seconds,
- sent_at: hit._source.sent_at_seconds,
+ thread_id: hit.source.entity_id,
+ message_id: hit.source.message_id,
+ subject: hit.source.subject,
+ sender: hit.source.sender,
+ recipients: hit.source.recipients,
+ cc: hit.source.cc,
+ bcc: hit.source.bcc,
+ labels: hit.source.labels,
+ link_id: hit.source.link_id,
+ user_id: hit.source.user_id,
+ updated_at: hit.source.updated_at_seconds,
+ sent_at: hit.source.sent_at_seconds,
+ score: hit.score,
highlight: hit
.highlight
.map(|h| {
diff --git a/rust/cloud-storage/opensearch_client/src/search/model.rs b/rust/cloud-storage/opensearch_client/src/search/model.rs
index 98c29ffda0..e3b1838cb0 100644
--- a/rust/cloud-storage/opensearch_client/src/search/model.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/model.rs
@@ -32,8 +32,10 @@ impl Display for MacroEm {
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub(crate) struct Hit<T> {
- pub _score: Option<f64>,
- pub _source: T,
+ #[serde(rename = "_score")]
+ pub score: Option<f64>,
+ #[serde(rename = "_source")]
+ pub source: T,
/// Highlights may or may not be present since we could match
/// purely on the title of the item
pub highlight: Option<HashMap<String, Vec<String>>>,
diff --git a/rust/cloud-storage/opensearch_client/src/search/projects.rs b/rust/cloud-storage/opensearch_client/src/search/projects.rs
index 1fe3b250e3..003f578ca5 100644
--- a/rust/cloud-storage/opensearch_client/src/search/projects.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/projects.rs
@@ -130,6 +130,7 @@ pub struct ProjectSearchResponse {
pub project_name: String,
pub created_at: i64,
pub updated_at: i64,
+ pub score: Option<f64>,
pub highlight: Highlight,
}
@@ -169,11 +170,12 @@ pub(crate) async fn search_projects(
.hits
.into_iter()
.map(|hit| ProjectSearchResponse {
- project_id: hit._source.entity_id,
- user_id: hit._source.user_id,
- project_name: hit._source.project_name,
- created_at: hit._source.created_at_seconds,
- updated_at: hit._source.updated_at_seconds,
+ project_id: hit.source.entity_id,
+ user_id: hit.source.user_id,
+ project_name: hit.source.project_name,
+ created_at: hit.source.created_at_seconds,
+ updated_at: hit.source.updated_at_seconds,
+ score: hit.score,
highlight: hit
.highlight
.map(|h| {
diff --git a/rust/cloud-storage/opensearch_client/src/search/unified.rs b/rust/cloud-storage/opensearch_client/src/search/unified.rs
index d267e1d84b..69f970f65c 100644
--- a/rust/cloud-storage/opensearch_client/src/search/unified.rs
+++ b/rust/cloud-storage/opensearch_client/src/search/unified.rs
@@ -259,7 +259,7 @@ where
impl From<Hit<UnifiedSearchIndex>> for UnifiedSearchResponse {
fn from(index: Hit<UnifiedSearchIndex>) -> Self {
- match index._source {
+ match index.source {
UnifiedSearchIndex::ChannelMessage(a) => {
UnifiedSearchResponse::ChannelMessage(ChannelMessageSearchResponse {
channel_id: a.entity_id,
@@ -272,6 +272,7 @@ impl From<Hit<UnifiedSearchIndex>> for UnifiedSearchResponse {
mentions: a.mentions,
created_at: a.created_at_seconds,
updated_at: a.updated_at_seconds,
+ score: index.score,
highlight: index
.highlight
.map(|h| {
@@ -295,6 +296,7 @@ impl From<Hit<UnifiedSearchIndex>> for UnifiedSearchResponse {
owner_id: a.owner_id,
file_type: a.file_type,
updated_at: a.updated_at_seconds,
+ score: index.score,
highlight: index
.highlight
.map(|h| {
@@ -322,6 +324,7 @@ impl From<Hit<UnifiedSearchIndex>> for UnifiedSearchResponse {
user_id: a.user_id,
updated_at: a.updated_at_seconds,
sent_at: a.sent_at_seconds,
+ score: index.score,
highlight: index
.highlight
.map(|h| {
@@ -342,6 +345,7 @@ impl From<Hit<UnifiedSearchIndex>> for UnifiedSearchResponse {
project_name: a.project_name,
created_at: a.created_at_seconds,
updated_at: a.updated_at_seconds,
+ score: index.score,
highlight: index
.highlight
.map(|h| {
@@ -362,6 +366,7 @@ impl From<Hit<UnifiedSearchIndex>> for UnifiedSearchResponse {
user_id: a.user_id,
role: a.role,
title: a.title,
+ score: index.score,
highlight: index
.highlight
.map(|h| {
diff --git a/rust/cloud-storage/search_service/src/api/search/channel/test.rs b/rust/cloud-storage/search_service/src/api/search/channel/test.rs
index 1dd0c3c446..b9ca8bcca1 100644
--- a/rust/cloud-storage/search_service/src/api/search/channel/test.rs
+++ b/rust/cloud-storage/search_service/src/api/search/channel/test.rs
@@ -24,6 +24,7 @@ fn test_construct_search_result_single_channel() {
mentions: vec!["@user2".to_string()],
created_at: 1234567890,
updated_at: 1234567891,
+ score: None,
highlight: Highlight {
name: None,
content: vec!["Test message content".to_string()],
@@ -77,6 +78,7 @@ fn test_construct_search_result_multiple_messages_same_channel() {
mentions: vec![],
created_at: 1234567890,
updated_at: 1234567891,
+ score: None,
highlight: Highlight {
name: None,
content: vec!["First message".to_string()],
@@ -93,6 +95,7 @@ fn test_construct_search_result_multiple_messages_same_channel() {
mentions: vec!["@user1".to_string()],
created_at: 1234567892,
updated_at: 1234567893,
+ score: None,
highlight: Highlight {
name: None,
content: vec!["Second message".to_string()],
@@ -148,6 +151,7 @@ fn test_construct_search_result_filters_messages_without_content() {
mentions: vec![],
created_at: 1234567890,
updated_at: 1234567891,
+ score: None,
highlight: Highlight {
name: None,
content: vec!["Message with content".to_string()],
@@ -164,6 +168,7 @@ fn test_construct_search_result_filters_messages_without_content() {
mentions: vec![],
created_at: 1234567892,
updated_at: 1234567893,
+ score: None,
highlight: Highlight::default(),
},
];
@@ -201,6 +206,7 @@ fn create_test_channel_response(
mentions: vec![],
created_at: 1234567890,
updated_at: 1234567891,
+ score: None,
highlight: Highlight {
name: None,
content: content.unwrap_or_default(),
diff --git a/rust/cloud-storage/search_service/src/api/search/chat/test.rs b/rust/cloud-storage/search_service/src/api/search/chat/test.rs
index 88c1b2733d..5c3833521c 100644
--- a/rust/cloud-storage/search_service/src/api/search/chat/test.rs
+++ b/rust/cloud-storage/search_service/src/api/search/chat/test.rs
@@ -16,6 +16,7 @@ fn create_test_response(
role: "user".to_string(),
updated_at: 1234567890,
title: "Test Chat".to_string(),
+ score: None,
highlight: Highlight {
name: None,
content: content.unwrap_or_default(),
diff --git a/rust/cloud-storage/search_service/src/api/search/document/test.rs b/rust/cloud-storage/search_service/src/api/search/document/test.rs
index 17ccc3f443..4705582575 100644
--- a/rust/cloud-storage/search_service/src/api/search/document/test.rs
+++ b/rust/cloud-storage/search_service/src/api/search/document/test.rs
@@ -20,6 +20,7 @@ fn test_construct_search_result_single_document() {
owner_id: "user1".to_string(),
file_type: "pdf".to_string(),
updated_at: 1234567890,
+ score: None,
highlight: Highlight {
name: None,
content: vec!["Test content".to_string()],
@@ -69,6 +70,7 @@ fn test_construct_search_result_multiple_nodes_same_document() {
owner_id: "user1".to_string(),
file_type: "pdf".to_string(),
updated_at: 1234567890,
+ score: None,
highlight: Highlight {
name: None,
content: vec!["First content".to_string()],
@@ -82,6 +84,7 @@ fn test_construct_search_result_multiple_nodes_same_document() {
owner_id: "user1".to_string(),
file_type: "pdf".to_string(),
updated_at: 1234567891,
+ score: None,
highlight: Highlight {
name: None,
content: vec!["Second content".to_string()],
@@ -136,6 +139,7 @@ fn create_test_document_response(
owner_id: owner_id.to_string(),
file_type: "pdf".to_string(),
updated_at: 1234567890,
+ score: None,
highlight: Highlight {
name: None,
content: content.unwrap_or_default(),
diff --git a/rust/cloud-storage/search_service/src/api/search/email/test.rs b/rust/cloud-storage/search_service/src/api/search/email/test.rs
index 914647e3b5..03e68fb1c0 100644
--- a/rust/cloud-storage/search_service/src/api/search/email/test.rs
+++ b/rust/cloud-storage/search_service/src/api/search/email/test.rs
@@ -37,6 +37,7 @@ fn test_construct_search_result_single_thread() {
updated_at: 1234567890,
sent_at: Some(1234567800),
subject: Some("Test Subject".to_string()),
+ score: None,
highlight: Highlight {
name: None,
content: vec!["Test content".to_string()],
diff --git a/rust/cloud-storage/search_service/src/api/search/unified.rs b/rust/cloud-storage/search_service/src/api/search/unified.rs
index 52bc0efac2..705010b545 100644
--- a/rust/cloud-storage/search_service/src/api/search/unified.rs
+++ b/rust/cloud-storage/search_service/src/api/search/unified.rs
@@ -85,8 +85,8 @@ pub async fn handler(
results.extend(enriched_project_results);
results.extend(enriched_email_results);
- // TODO: sort at the end. need to expose hit score first
- // https://linear.app/macro-eng/issue/M-5244/sort-by-hit-score-after-combining-enriched-results
+ // Sort the results by their average score
+ results.sort_by(|a, b| b.average_score().total_cmp(&a.average_score()));
Ok((StatusCode::OK, Json(UnifiedSearchResponse { results })).into_response())
}
diff --git a/rust/cloud-storage/search_service/src/model/mod.rs b/rust/cloud-storage/search_service/src/model/mod.rs
index 1f4601c48a..3c6ee78f8f 100644
--- a/rust/cloud-storage/search_service/src/model/mod.rs
+++ b/rust/cloud-storage/search_service/src/model/mod.rs
@@ -32,6 +32,7 @@ impl From<&ChatOpenSearchResponse> for Option<ChatMessageSearchResult> {
highlight: response.inner.highlight.clone().into(),
updated_at: response.inner.updated_at,
title: response.inner.title.clone(),
+ score: response.inner.score,
})
}
}
@@ -74,6 +75,7 @@ impl From<&ProjectOpenSearchResponse> for Option<ProjectSearchResult> {
fn from(response: &ProjectOpenSearchResponse) -> Self {
Some(ProjectSearchResult {
highlight: response.inner.highlight.clone().into(),
+ score: response.inner.score,
})
}
}
@@ -109,6 +111,7 @@ impl From<&DocumentOpenSearchResponse> for Option<DocumentSearchResult> {
raw_content: response.inner.raw_content.clone(),
updated_at: response.inner.updated_at,
highlight: response.inner.highlight.clone().into(),
+ score: response.inner.score,
})
}
}
@@ -149,6 +152,7 @@ impl From<&EmailOpenSearchResponse> for Option<EmailSearchResult> {
highlight: response.inner.highlight.clone().into(),
updated_at: response.inner.updated_at,
sent_at: response.inner.sent_at,
+ score: response.inner.score,
})
}
}
@@ -186,6 +190,7 @@ impl From<&ChannelOpenSearchResponse> for Option<ChannelSearchResult> {
highlight: response.inner.highlight.clone().into(),
updated_at: response.inner.updated_at,
created_at: response.inner.created_at,
+ score: response.inner.score,
})
}
}