Turn message search into streams#6661
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6661 +/- ##
==========================================
+ Coverage 89.89% 89.90% +0.01%
==========================================
Files 396 396
Lines 110412 110317 -95
Branches 110412 110317 -95
==========================================
- Hits 99258 99186 -72
+ Misses 7370 7367 -3
+ Partials 3784 3764 -20 ☔ View full report in Codecov by Harness. |
f59d164 to
65b0882
Compare
`Room::search_messages` returned a hand-rolled `RoomSearchIterator` with manual `offset`/`is_done` bookkeeping that reimplemented a stream. Replace it with real streams that paginate the index lazily as polled with `Room::search_messages` yielding `(score, event_id)` pairs and `Room::search_messages_events` full timeline events.
Replace the hand-rolled `GlobalSearchIterator` with a `Stream` that performs a k-way merge across room streams. Similar to the room, `GlobalSearchBuilder::build` yields `(room_id, score, event_id)` tuples and `GlobalSearchBuilder::build_events` full timeline events.
Adapt the global and single-room search UI flows to poll the new SDK search streams directly instead of the removed iterator.
The SDK's message search now exposes streams instead of iterators. Keep the `RoomSearchIterator`/`GlobalSearchIterator` objects and their batch- oriented `next_events()` surface unchanged but back them with a boxed SDK search stream they pull `num_results_per_batch` items from.
65b0882 to
acdfff6
Compare
poljar
approved these changes
Jun 25, 2026
poljar
left a comment
Contributor
There was a problem hiding this comment.
Looks mostly good, let's just switch to a stream of pages/chunks.
Have the search streams yield whole pages instead of individual results so consumers can decide to stop between (potentially expensive) polls, and to mirror how server-side search pagination works.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This series of patches reworks the SDK's message search to expose results as streams instead of the hand-rolled iterators. They reimplemented streaming (manual
offset/is_done/ batch-buffer bookkeeping) without any of its benefits.The FFI layer keeps its current interface but it will probably get removed entirely when we introduce the new GlobalSearchService.