-
Notifications
You must be signed in to change notification settings - Fork 399
MSC3666: Bundled aggregations for server side search #3666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b24e29c
Initial commit.
clokep 19b1aca
MSC number.
clokep 33d72e2
Link to the current specification.
clokep d558902
Clarify that this is a change (and not part of MSC2675).
clokep a9c2864
Remove extra work.
clokep fb0a9a1
Add missing slashes and some links.
clokep File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# MSC3666: Bundled aggregations for server side search | ||
|
||
[MSC2675](https://github.com/matrix-org/matrix-doc/pull/2675) defines a way for | ||
homeservers to include events related to a requested event via "bundled aggregations". | ||
These bundled aggregations help a client render a requested event without needing | ||
to fetch additional information from the server. | ||
|
||
As part of MSC2675 the following APIs should include bundled aggregations: | ||
|
||
* `GET /rooms/{roomId}/messages` | ||
* `GET /rooms/{roomId}/context/{eventId}` | ||
* `GET /rooms/{roomId}/event/{eventId}` | ||
* `GET /sync`, only for room sections in the response where limited field is true; | ||
this amounts to all rooms in the response if the since request parameter was | ||
not passed, also known as an initial sync. | ||
* `GET /rooms{roomId}/relations/{eventId}` | ||
clokep marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
A noticeable missing API from here is the server side search feature (`POST /search`) | ||
where it is common for a client to not have the full timeline of a room when | ||
receiving results. This would benefit from having the bundled aggregations. | ||
|
||
|
||
## Proposal | ||
|
||
The server side search API (`POST /search`) for the `room_events` category will | ||
clokep marked this conversation as resolved.
Show resolved
Hide resolved
|
||
include bundled aggregations for any matching events returned to the client. | ||
Per MSC2675 the `unsigned` field of the results would include `m.relations` where | ||
clokep marked this conversation as resolved.
Show resolved
Hide resolved
|
||
appropriate. This applies to any events themselves, as well as contextual events | ||
returned, these appear as the following fields: | ||
clokep marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
* The event itself: `results["search_categories"]["room_events"]["results"]["result"]` | ||
* Each contextual event in: | ||
* `results["search_categories"]["room_events"]["results"]["context"]["events_before"]` | ||
* `results["search_categories"]["room_events"]["results"]["context"]["events_after"]` | ||
|
||
|
||
## Potential issues | ||
|
||
The `/search` API is already fairly complicated and can be slow for large rooms. | ||
Returning more data from it could cause performance issues. | ||
|
||
|
||
## Alternatives | ||
|
||
The status quo is that a client can call `/rooms{roomId}/relations/{eventId}` for | ||
each event in the search results in order to fully render each event. This is | ||
expensive, slow, and bandwidth heavy since clients generally need the aggregated | ||
relations, not each related event. | ||
|
||
Older versions of MSC2675 included an `/rooms{roomId}/aggregations/{eventId}` API | ||
to fetch the bundled aggregations for an event directly. This would save on bandwidth | ||
and simplify the work that clients need to achieve, but would still need result | ||
clokep marked this conversation as resolved.
Show resolved
Hide resolved
|
||
in needless roundtrips as it would have to be called per event. | ||
|
||
|
||
## Security considerations | ||
|
||
None. | ||
|
||
|
||
## Unstable prefix | ||
|
||
N/A | ||
richvdh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
## Dependencies | ||
|
||
This MSC builds on [MSC2674](https://github.com/matrix-org/matrix-doc/pull/2674) | ||
and [MSC2675](https://github.com/matrix-org/matrix-doc/pull/2675), which have | ||
been accepted, but are not yet in a released version of the spec at the time of | ||
writing. |
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.
Uh oh!
There was an error while loading. Please reload this page.