workaround to fix search in element

We inherited a similar workaround from conduit, but removed it in
71c48f66c4. At the time, it was not clear
that this had broken search.

Fixes: !26
This commit is contained in:
Benjamin Lee 2024-06-03 17:41:11 -07:00
parent 5c39c7c5ff
commit c64a474954
No known key found for this signature in database
GPG key ID: FB9624E2885D55A4

View file

@ -11,7 +11,7 @@ use ruma::{
}, },
}, },
}, },
uint, uint, UInt,
}; };
use crate::{services, Ar, Error, Ra, Result}; use crate::{services, Ar, Error, Ra, Result};
@ -138,7 +138,13 @@ pub(crate) async fn search_events_route(
Ok(Ra(search_events::v3::Response::new(ResultCategories { Ok(Ra(search_events::v3::Response::new(ResultCategories {
room_events: ResultRoomEvents { room_events: ResultRoomEvents {
count: None, // TODO(compat): this is not a good estimate of the total number of
// results. we should just be returning None, but
// element incorrectly relies on this field. Switch back
// to None when [1] is fixed
//
// [1]: https://github.com/element-hq/element-web/issues/27517
count: Some(results.len().try_into().unwrap_or(UInt::MAX)),
// TODO // TODO
groups: BTreeMap::new(), groups: BTreeMap::new(),
next_batch, next_batch,