feat(search): server search in the engine
- Remote server_search_init, server_suggestions, server_query (Graph impl via Substrate) - engine resolves my user and tenant id for the anchor mailbox - ROADMAP: server search moved from out of scope to Partial Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -15,7 +15,7 @@ Feature parity with the Microsoft Teams desktop client.
15
15
| [Message actions](#message-actions) | 100 % | 5 | 0 | 0 |
16
16
| [Channels](#channels) | 100 % | 7 | 0 | 0 |
17
17
| [Notifications](#notifications) | 89 % | 8 | 0 | 1 |
18
| [Search and navigation](#search-and-navigation) | 100 % | 5 | 0 | 0 |
18
| [Search and navigation](#search-and-navigation) | 92 % | 5 | 1 | 0 |
19
19
| [Presence and people](#presence-and-people) | 100 % | 4 | 0 | 0 |
20
20
| [Look and settings](#look-and-settings) | 50 % | 2 | 0 | 2 |
21
21
| [Calls and meetings](#calls-and-meetings) | 62 % | 15 | 18 | 6 |
@@ -138,6 +138,7 @@ Feature parity with the Microsoft Teams desktop client.
138
138
| Ctrl+K switcher over chats, channels, people | Done | |
139
139
| Full-text search over cached messages | Done | |
140
140
| Jump to a message from search | Done | |
141
| Server search over the full history like Teams | Partial | Substrate search client in the engine (typeahead, results by tab, find in chat, KQL filters); palette and results page still use the local index |
141
142
| Esc closes the open conversation or editor | Done | Back to the channel keeps the feed position |
142
143
| Keyboard shortcuts like Teams | Done | Ctrl+1 Activity, 2 Chats, 3 Channels, 4 Saved; Alt+Up/Down previous and next chat or channel in the visible list, also while typing; calls Ctrl+Shift+A accept, D decline, H hang up, O camera, E share menu, K raise hand, Y lobby, M mute, J join from a meeting reminder, Space held with Ctrl to talk while muted, F11 full screen, Alt+Shift+A / V start an audio / video call in the open chat; Ctrl+. lists all shortcuts. Ctrl+5..9 not used |
143
144
@@ -225,7 +226,6 @@ After parity. Not counted in the parity score.
225
226
| Feature | Why |
226
227
|---|---|
227
228
| Personal apps in the app bar | Outside chat and channels |
228
| Server-side search | The local index answers faster |
229
229
| Copilot, intelligent recap, AI notes, Facilitator, Interpreter | Needs a Microsoft 365 Copilot licence; left out on purpose |
230
230
| Teams Premium features (translated captions, watermark, E2EE meetings, templates, branding) | Needs a Teams Premium licence |
231
231
| Phone system: dial pad, park, forwarding, voicemail, delegation, queues | Needs a Teams Phone licence; none on the test account |
@@ -15,7 +15,7 @@ Feature parity with the Microsoft Teams desktop client.15
| [Message actions](#message-actions) | 100 % | 5 | 0 | 0 |15
| [Message actions](#message-actions) | 100 % | 5 | 0 | 0 |16
| [Channels](#channels) | 100 % | 7 | 0 | 0 |16
| [Channels](#channels) | 100 % | 7 | 0 | 0 |17
| [Notifications](#notifications) | 89 % | 8 | 0 | 1 |17
| [Notifications](#notifications) | 89 % | 8 | 0 | 1 |18
| [Search and navigation](#search-and-navigation) | 100 % | 5 | 0 | 0 |18
| [Search and navigation](#search-and-navigation) | 92 % | 5 | 1 | 0 |19
| [Presence and people](#presence-and-people) | 100 % | 4 | 0 | 0 |19
| [Presence and people](#presence-and-people) | 100 % | 4 | 0 | 0 |20
| [Look and settings](#look-and-settings) | 50 % | 2 | 0 | 2 |20
| [Look and settings](#look-and-settings) | 50 % | 2 | 0 | 2 |21
| [Calls and meetings](#calls-and-meetings) | 62 % | 15 | 18 | 6 |21
| [Calls and meetings](#calls-and-meetings) | 62 % | 15 | 18 | 6 |@@ -138,6 +138,7 @@ Feature parity with the Microsoft Teams desktop client.138
| Ctrl+K switcher over chats, channels, people | Done | |138
| Ctrl+K switcher over chats, channels, people | Done | |139
| Full-text search over cached messages | Done | |139
| Full-text search over cached messages | Done | |140
| Jump to a message from search | Done | |140
| Jump to a message from search | Done | |141
| Server search over the full history like Teams | Partial | Substrate search client in the engine (typeahead, results by tab, find in chat, KQL filters); palette and results page still use the local index |141
| Esc closes the open conversation or editor | Done | Back to the channel keeps the feed position |142
| Esc closes the open conversation or editor | Done | Back to the channel keeps the feed position |142
| Keyboard shortcuts like Teams | Done | Ctrl+1 Activity, 2 Chats, 3 Channels, 4 Saved; Alt+Up/Down previous and next chat or channel in the visible list, also while typing; calls Ctrl+Shift+A accept, D decline, H hang up, O camera, E share menu, K raise hand, Y lobby, M mute, J join from a meeting reminder, Space held with Ctrl to talk while muted, F11 full screen, Alt+Shift+A / V start an audio / video call in the open chat; Ctrl+. lists all shortcuts. Ctrl+5..9 not used |143
| Keyboard shortcuts like Teams | Done | Ctrl+1 Activity, 2 Chats, 3 Channels, 4 Saved; Alt+Up/Down previous and next chat or channel in the visible list, also while typing; calls Ctrl+Shift+A accept, D decline, H hang up, O camera, E share menu, K raise hand, Y lobby, M mute, J join from a meeting reminder, Space held with Ctrl to talk while muted, F11 full screen, Alt+Shift+A / V start an audio / video call in the open chat; Ctrl+. lists all shortcuts. Ctrl+5..9 not used |143
144
@@ -225,7 +226,6 @@ After parity. Not counted in the parity score.225
| Feature | Why |226
| Feature | Why |226
|---|---|227
|---|---|227
| Personal apps in the app bar | Outside chat and channels |228
| Personal apps in the app bar | Outside chat and channels |228
| Server-side search | The local index answers faster |229
| Copilot, intelligent recap, AI notes, Facilitator, Interpreter | Needs a Microsoft 365 Copilot licence; left out on purpose |229
| Copilot, intelligent recap, AI notes, Facilitator, Interpreter | Needs a Microsoft 365 Copilot licence; left out on purpose |230
| Teams Premium features (translated captions, watermark, E2EE meetings, templates, branding) | Needs a Teams Premium licence |230
| Teams Premium features (translated captions, watermark, E2EE meetings, templates, branding) | Needs a Teams Premium licence |231
| Phone system: dial pad, park, forwarding, voicemail, delegation, queues | Needs a Teams Phone licence; none on the test account |231
| Phone system: dial pad, park, forwarding, voicemail, delegation, queues | Needs a Teams Phone licence; none on the test account |@@ -339,6 +339,24 @@ impl<R: Remote> SyncEngine<R> {
339
339
Ok(tenant.clone())
340
340
}
341
341
342
pub(crate) async fn my_tenant_id_from_any_chat(&self) -> Result<String> {
343
if let Some(tenant) = self.my_tenant_id.get() {
344
return Ok(tenant.clone());
345
}
346
if let Some(cached) = self.store.meta(META_TENANT_ID)? {
347
return Ok(cached);
348
}
349
let any_chat_id = self
350
.store
351
.sidebar()?
352
.chats
353
.into_iter()
354
.next()
355
.map(|chat| chat.id)
356
.ok_or(Error::Unsupported("a tenant id without a known chat"))?;
357
self.my_tenant_id(&any_chat_id).await
358
}
359
342
360
pub(crate) async fn resolve(&self, conversation_id: &str) -> Result<Conversation> {
343
361
match self.resolve_stored(conversation_id) {
344
362
Err(Error::UnknownConversation(_)) => self.fetch_unknown_chat(conversation_id).await,
@@ -339,6 +339,24 @@ impl<R: Remote> SyncEngine<R> {339
Ok(tenant.clone())339
Ok(tenant.clone())340
}340
}341
341
342
pub(crate) async fn my_tenant_id_from_any_chat(&self) -> Result<String> {343
if let Some(tenant) = self.my_tenant_id.get() {344
return Ok(tenant.clone());345
}346
if let Some(cached) = self.store.meta(META_TENANT_ID)? {347
return Ok(cached);348
}349
let any_chat_id = self350
.store351
.sidebar()?352
.chats353
.into_iter()354
.next()355
.map(|chat| chat.id)356
.ok_or(Error::Unsupported("a tenant id without a known chat"))?;357
self.my_tenant_id(&any_chat_id).await358
}359
342
pub(crate) async fn resolve(&self, conversation_id: &str) -> Result<Conversation> {360
pub(crate) async fn resolve(&self, conversation_id: &str) -> Result<Conversation> {343
match self.resolve_stored(conversation_id) {361
match self.resolve_stored(conversation_id) {344
Err(Error::UnknownConversation(_)) => self.fetch_unknown_chat(conversation_id).await,362
Err(Error::UnknownConversation(_)) => self.fetch_unknown_chat(conversation_id).await,@@ -50,6 +50,7 @@ mod remote;
50
50
mod scheduled;
51
51
mod skin_tone;
52
52
mod search;
53
mod server_search;
53
54
mod sidebar_sync;
54
55
mod spans;
55
56
mod stored;
@@ -97,6 +98,7 @@ pub use chatsvc::{
97
98
WindowDirection, WorkLocation, WorkLocationKind, WorkLocationSource,
98
99
};
99
100
pub use chatsvc::{ChatSection, ChatSectionSettings, RecordingPolicy};
101
pub use chatsvc::substrate_search;
100
102
pub use chatsvc::{
101
103
Language, LanguageSettings, MessageLanguage, Translation, TranslationBehavior,
102
104
TranslationStatus, TranslationTrigger, authoring_patch, behavior_patch, language_code,
@@ -50,6 +50,7 @@ mod remote;50
mod scheduled;50
mod scheduled;51
mod skin_tone;51
mod skin_tone;52
mod search;52
mod search;53
mod server_search;53
mod sidebar_sync;54
mod sidebar_sync;54
mod spans;55
mod spans;55
mod stored;56
mod stored;@@ -97,6 +98,7 @@ pub use chatsvc::{97
WindowDirection, WorkLocation, WorkLocationKind, WorkLocationSource,98
WindowDirection, WorkLocation, WorkLocationKind, WorkLocationSource,98
};99
};99
pub use chatsvc::{ChatSection, ChatSectionSettings, RecordingPolicy};100
pub use chatsvc::{ChatSection, ChatSectionSettings, RecordingPolicy};101
pub use chatsvc::substrate_search;100
pub use chatsvc::{102
pub use chatsvc::{101
Language, LanguageSettings, MessageLanguage, Translation, TranslationBehavior,103
Language, LanguageSettings, MessageLanguage, Translation, TranslationBehavior,102
TranslationStatus, TranslationTrigger, authoring_patch, behavior_patch, language_code,104
TranslationStatus, TranslationTrigger, authoring_patch, behavior_patch, language_code,@@ -8,6 +8,9 @@ use chatsvc::{
8
8
Translation, TranslationTrigger, Translator, WindowDirection, WorkLocationKind,
9
9
};
10
10
use chatsvc::sound_settings::{SoundSettings, SoundSettingsClient};
11
use chatsvc::substrate_search::{
12
QueryRequest, QueryResults, SearchIdentity, SearchSession, SubstrateSearch, Suggestions,
13
};
11
14
use chrono::{DateTime, Utc};
12
15
use graph::{
13
16
Channel, Chat, DriveEntry, DriveFolder, Graph, Member, Message, MessageExtras, MessageTarget,
@@ -438,6 +441,32 @@ pub trait Remote {
438
441
Err(Error::Unsupported("GIF search"))
439
442
}
440
443
444
async fn server_search_init(
445
&self,
446
_identity: &SearchIdentity,
447
_search_session: &SearchSession,
448
) -> Result<()> {
449
Err(Error::Unsupported("server search"))
450
}
451
452
async fn server_suggestions(
453
&self,
454
_identity: &SearchIdentity,
455
_search_session: &SearchSession,
456
_text: &str,
457
) -> Result<Suggestions> {
458
Err(Error::Unsupported("server search"))
459
}
460
461
async fn server_query(
462
&self,
463
_identity: &SearchIdentity,
464
_search_session: &SearchSession,
465
_request: &QueryRequest,
466
) -> Result<QueryResults> {
467
Err(Error::Unsupported("server search"))
468
}
469
441
470
async fn create_scheduled(
442
471
&self,
443
472
_inner_thread_id: &str,
@@ -1092,6 +1121,38 @@ impl Remote for Graph {
1092
1121
Ok(Gifs::new(self.session()).search(query).await?)
1093
1122
}
1094
1123
1124
async fn server_search_init(
1125
&self,
1126
identity: &SearchIdentity,
1127
search_session: &SearchSession,
1128
) -> Result<()> {
1129
Ok(SubstrateSearch::new(self.session(), identity.clone())
1130
.init(search_session)
1131
.await?)
1132
}
1133
1134
async fn server_suggestions(
1135
&self,
1136
identity: &SearchIdentity,
1137
search_session: &SearchSession,
1138
text: &str,
1139
) -> Result<Suggestions> {
1140
Ok(SubstrateSearch::new(self.session(), identity.clone())
1141
.suggestions(search_session, text)
1142
.await?)
1143
}
1144
1145
async fn server_query(
1146
&self,
1147
identity: &SearchIdentity,
1148
search_session: &SearchSession,
1149
request: &QueryRequest,
1150
) -> Result<QueryResults> {
1151
Ok(SubstrateSearch::new(self.session(), identity.clone())
1152
.query(search_session, request)
1153
.await?)
1154
}
1155
1095
1156
async fn create_scheduled(
1096
1157
&self,
1097
1158
inner_thread_id: &str,
@@ -8,6 +8,9 @@ use chatsvc::{8
Translation, TranslationTrigger, Translator, WindowDirection, WorkLocationKind,8
Translation, TranslationTrigger, Translator, WindowDirection, WorkLocationKind,9
};9
};10
use chatsvc::sound_settings::{SoundSettings, SoundSettingsClient};10
use chatsvc::sound_settings::{SoundSettings, SoundSettingsClient};11
use chatsvc::substrate_search::{12
QueryRequest, QueryResults, SearchIdentity, SearchSession, SubstrateSearch, Suggestions,13
};11
use chrono::{DateTime, Utc};14
use chrono::{DateTime, Utc};12
use graph::{15
use graph::{13
Channel, Chat, DriveEntry, DriveFolder, Graph, Member, Message, MessageExtras, MessageTarget,16
Channel, Chat, DriveEntry, DriveFolder, Graph, Member, Message, MessageExtras, MessageTarget,@@ -438,6 +441,32 @@ pub trait Remote {438
Err(Error::Unsupported("GIF search"))441
Err(Error::Unsupported("GIF search"))439
}442
}440
443
444
async fn server_search_init(445
&self,446
_identity: &SearchIdentity,447
_search_session: &SearchSession,448
) -> Result<()> {449
Err(Error::Unsupported("server search"))450
}451
452
async fn server_suggestions(453
&self,454
_identity: &SearchIdentity,455
_search_session: &SearchSession,456
_text: &str,457
) -> Result<Suggestions> {458
Err(Error::Unsupported("server search"))459
}460
461
async fn server_query(462
&self,463
_identity: &SearchIdentity,464
_search_session: &SearchSession,465
_request: &QueryRequest,466
) -> Result<QueryResults> {467
Err(Error::Unsupported("server search"))468
}469
441
async fn create_scheduled(470
async fn create_scheduled(442
&self,471
&self,443
_inner_thread_id: &str,472
_inner_thread_id: &str,@@ -1092,6 +1121,38 @@ impl Remote for Graph {1092
Ok(Gifs::new(self.session()).search(query).await?)1121
Ok(Gifs::new(self.session()).search(query).await?)1093
}1122
}1094
1123
1124
async fn server_search_init(1125
&self,1126
identity: &SearchIdentity,1127
search_session: &SearchSession,1128
) -> Result<()> {1129
Ok(SubstrateSearch::new(self.session(), identity.clone())1130
.init(search_session)1131
.await?)1132
}1133
1134
async fn server_suggestions(1135
&self,1136
identity: &SearchIdentity,1137
search_session: &SearchSession,1138
text: &str,1139
) -> Result<Suggestions> {1140
Ok(SubstrateSearch::new(self.session(), identity.clone())1141
.suggestions(search_session, text)1142
.await?)1143
}1144
1145
async fn server_query(1146
&self,1147
identity: &SearchIdentity,1148
search_session: &SearchSession,1149
request: &QueryRequest,1150
) -> Result<QueryResults> {1151
Ok(SubstrateSearch::new(self.session(), identity.clone())1152
.query(search_session, request)1153
.await?)1154
}1155
1095
async fn create_scheduled(1156
async fn create_scheduled(1096
&self,1157
&self,1097
inner_thread_id: &str,1158
inner_thread_id: &str,@@ -0,0 +1,46 @@
1
use chatsvc::substrate_search::{
2
QueryRequest, QueryResults, SearchIdentity, SearchSession, Suggestions,
3
};
4
5
use crate::engine::SyncEngine;
6
use crate::error::Result;
7
use crate::remote::Remote;
8
9
impl<R: Remote> SyncEngine<R> {
10
pub async fn server_search_init(&self, search_session: &SearchSession) -> Result<()> {
11
let identity = self.search_identity().await?;
12
self.remote
13
.server_search_init(&identity, search_session)
14
.await
15
}
16
17
/// An empty text returns the zero-query state (top people, recent searches).
18
pub async fn server_suggestions(
19
&self,
20
search_session: &SearchSession,
21
text: &str,
22
) -> Result<Suggestions> {
23
let identity = self.search_identity().await?;
24
self.remote
25
.server_suggestions(&identity, search_session, text)
26
.await
27
}
28
29
pub async fn server_query(
30
&self,
31
search_session: &SearchSession,
32
request: &QueryRequest,
33
) -> Result<QueryResults> {
34
let identity = self.search_identity().await?;
35
self.remote
36
.server_query(&identity, search_session, request)
37
.await
38
}
39
40
async fn search_identity(&self) -> Result<SearchIdentity> {
41
Ok(SearchIdentity {
42
user_id: self.my_user_id().await?,
43
tenant_id: self.my_tenant_id_from_any_chat().await?,
44
})
45
}
46
}
@@ -0,0 +1,46 @@1
use chatsvc::substrate_search::{2
QueryRequest, QueryResults, SearchIdentity, SearchSession, Suggestions,3
};4
5
use crate::engine::SyncEngine;6
use crate::error::Result;7
use crate::remote::Remote;8
9
impl<R: Remote> SyncEngine<R> {10
pub async fn server_search_init(&self, search_session: &SearchSession) -> Result<()> {11
let identity = self.search_identity().await?;12
self.remote13
.server_search_init(&identity, search_session)14
.await15
}16
17
/// An empty text returns the zero-query state (top people, recent searches).18
pub async fn server_suggestions(19
&self,20
search_session: &SearchSession,21
text: &str,22
) -> Result<Suggestions> {23
let identity = self.search_identity().await?;24
self.remote25
.server_suggestions(&identity, search_session, text)26
.await27
}28
29
pub async fn server_query(30
&self,31
search_session: &SearchSession,32
request: &QueryRequest,33
) -> Result<QueryResults> {34
let identity = self.search_identity().await?;35
self.remote36
.server_query(&identity, search_session, request)37
.await38
}39
40
async fn search_identity(&self) -> Result<SearchIdentity> {41
Ok(SearchIdentity {42
user_id: self.my_user_id().await?,43
tenant_id: self.my_tenant_id_from_any_chat().await?,44
})45
}46
}@@ -15,6 +15,7 @@ use teams_core::{
15
15
Availability, BoxFuture, ChatFolder, ChatSection, ChatSectionSettings, ChatsPage, CoreEvent,
16
16
DeltaPage, Error, FolderChange, FolderKind, FolderSource, MentionCandidate, MentionInput,
17
17
MentionTarget, PersonSource, Remote, RemotePage, Result, SyncConfig, SyncEngine,
18
substrate_search,
18
19
};
19
20
20
21
const ME: &str = "user-me";
@@ -132,6 +133,7 @@ struct Fake {
132
133
note_puts: Mutex<Vec<Option<chatsvc::StatusNote>>>,
133
134
window_answer: Mutex<Option<chatsvc::MessageWindow>>,
134
135
window_requests: Mutex<Vec<(String, chatsvc::WindowDirection)>>,
136
search_identities: Mutex<Vec<substrate_search::SearchIdentity>>,
135
137
}
136
138
137
139
impl Fake {
@@ -195,6 +197,20 @@ impl Fake {
195
197
}
196
198
197
199
impl Remote for Handle {
200
async fn server_suggestions(
201
&self,
202
identity: &substrate_search::SearchIdentity,
203
_search_session: &substrate_search::SearchSession,
204
text: &str,
205
) -> Result<substrate_search::Suggestions> {
206
self.search_identities
207
.lock()
208
.unwrap()
209
.push(identity.clone());
210
self.record(format!("server_suggestions:{text}"));
211
Ok(substrate_search::Suggestions::default())
212
}
213
198
214
async fn me(&self) -> Result<User> {
199
215
Ok(serde_json::from_value(json!({"id": ME, "displayName": "Me Myself"})).unwrap())
200
216
}
@@ -4740,3 +4756,24 @@ async fn a_forward_cached_without_its_content_is_read_again_once() {
4740
4756
engine.fetch_newer(CHAT).await.unwrap();
4741
4757
assert_eq!(reads(&fake), 1);
4742
4758
}
4759
4760
#[tokio::test]
4761
async fn server_search_is_anchored_to_my_user_and_tenant() {
4762
let fake = Arc::new(Fake::default());
4763
let engine = chat_engine(&fake, SyncConfig::default()).await;
4764
let search_session = substrate_search::SearchSession::new();
4765
engine
4766
.server_suggestions(&search_session, "ada")
4767
.await
4768
.unwrap();
4769
engine
4770
.server_suggestions(&search_session, "adam")
4771
.await
4772
.unwrap();
4773
let identities = fake.search_identities.lock().unwrap().clone();
4774
let expected = substrate_search::SearchIdentity {
4775
user_id: ME.to_owned(),
4776
tenant_id: "tenant-1".to_owned(),
4777
};
4778
assert_eq!(identities, [expected.clone(), expected]);
4779
}
@@ -15,6 +15,7 @@ use teams_core::{15
Availability, BoxFuture, ChatFolder, ChatSection, ChatSectionSettings, ChatsPage, CoreEvent,15
Availability, BoxFuture, ChatFolder, ChatSection, ChatSectionSettings, ChatsPage, CoreEvent,16
DeltaPage, Error, FolderChange, FolderKind, FolderSource, MentionCandidate, MentionInput,16
DeltaPage, Error, FolderChange, FolderKind, FolderSource, MentionCandidate, MentionInput,17
MentionTarget, PersonSource, Remote, RemotePage, Result, SyncConfig, SyncEngine,17
MentionTarget, PersonSource, Remote, RemotePage, Result, SyncConfig, SyncEngine,18
substrate_search,18
};19
};19
20
20
const ME: &str = "user-me";21
const ME: &str = "user-me";@@ -132,6 +133,7 @@ struct Fake {132
note_puts: Mutex<Vec<Option<chatsvc::StatusNote>>>,133
note_puts: Mutex<Vec<Option<chatsvc::StatusNote>>>,133
window_answer: Mutex<Option<chatsvc::MessageWindow>>,134
window_answer: Mutex<Option<chatsvc::MessageWindow>>,134
window_requests: Mutex<Vec<(String, chatsvc::WindowDirection)>>,135
window_requests: Mutex<Vec<(String, chatsvc::WindowDirection)>>,136
search_identities: Mutex<Vec<substrate_search::SearchIdentity>>,135
}137
}136
138
137
impl Fake {139
impl Fake {@@ -195,6 +197,20 @@ impl Fake {195
}197
}196
198
197
impl Remote for Handle {199
impl Remote for Handle {200
async fn server_suggestions(201
&self,202
identity: &substrate_search::SearchIdentity,203
_search_session: &substrate_search::SearchSession,204
text: &str,205
) -> Result<substrate_search::Suggestions> {206
self.search_identities207
.lock()208
.unwrap()209
.push(identity.clone());210
self.record(format!("server_suggestions:{text}"));211
Ok(substrate_search::Suggestions::default())212
}213
198
async fn me(&self) -> Result<User> {214
async fn me(&self) -> Result<User> {199
Ok(serde_json::from_value(json!({"id": ME, "displayName": "Me Myself"})).unwrap())215
Ok(serde_json::from_value(json!({"id": ME, "displayName": "Me Myself"})).unwrap())200
}216
}@@ -4740,3 +4756,24 @@ async fn a_forward_cached_without_its_content_is_read_again_once() {4740
engine.fetch_newer(CHAT).await.unwrap();4756
engine.fetch_newer(CHAT).await.unwrap();4741
assert_eq!(reads(&fake), 1);4757
assert_eq!(reads(&fake), 1);4742
}4758
}4759
4760
#[tokio::test]4761
async fn server_search_is_anchored_to_my_user_and_tenant() {4762
let fake = Arc::new(Fake::default());4763
let engine = chat_engine(&fake, SyncConfig::default()).await;4764
let search_session = substrate_search::SearchSession::new();4765
engine4766
.server_suggestions(&search_session, "ada")4767
.await4768
.unwrap();4769
engine4770
.server_suggestions(&search_session, "adam")4771
.await4772
.unwrap();4773
let identities = fake.search_identities.lock().unwrap().clone();4774
let expected = substrate_search::SearchIdentity {4775
user_id: ME.to_owned(),4776
tenant_id: "tenant-1".to_owned(),4777
};4778
assert_eq!(identities, [expected.clone(), expected]);4779
}