element-hq / element-hq/synapse

/_matrix/client/r0/search: limit affects total number of results returned

Open
#8,491 0 comments 1 reaction 0 assignees View on GitHub
A-Search O-Occasional S-Minor T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#8491](https://github.com/matrix-org/synapse/issues/8491).

---

Synapse 1.20.0rc5

```
~> curl -XPOST -H 'Authorization: Bearer '$access_token -d '{
"search_categories":{
"room_events":{
"filter":{
"senders":["@tulir:maunium.net"],
"limit":10
},
"order_by":"recent",
"search_term":"foo"
}
}
}' "https://matrix.fentker.eu:8448/_matrix/client/r0/search" 2>/dev/null
{
"search_categories": {
"room_events": {
"count": 2678,
"highlights": [
"footage",
"food",
"footprint",
"foot",
"foo.jpg",
"fools",
"footsteps",
"foolproof",
"foo",
"foodb",
"foobar",
"foo.tmp341025624588",
"football",
"fool",
"fooled",
"foo.uniquecol",
"footer",
"footnotes",
"foo.bar"
],
"results": []
}
}
}
```
```
~> curl -XPOST -H 'Authorization: Bearer '$access_token -d '{
"search_categories":{
"room_events":{
"filter":{
"senders":["@tulir:maunium.net"],
"limit":500
},
"order_by":"recent",
"search_term":"foo"
}
}
}' "https://matrix.fentker.eu:8448/_matrix/client/r0/search" 2>/dev/null
{
"search_categories": {
"room_events": {
"count": 2678,
"highlights": [
"foo.example.com",
"foodbuser",
"fooevent",
"foolish",
"foosinn",
"foods",
"foodb",
"foo.avg",
"footlocker",
"foo.is",
"foo.ovpn",
"foo.srt",
"foo.jar",
"footstep",
"foo.png",
"fooken",
"foobar",
"foo.tablename",
"footguns",
"foo2",
"foor",
"foolishly",
"foothold",
"foousers",
"footnote",
"fooled",
"foo.tld",
"foo.bar",
"foo.csv",
"footers",
"footwear",
"footage",
"foobarbaz",
"foot",
"fooden",
"foo.jpg",
"fools",
"footsteps",
"foonetic",
"foobarurl",
"footime",
"footgun",
"foo.txt",
"foolproof",
"foo",
"footprints",
"foo.tmp341025624588",
"football",
"footer",
"footclient",
"footnotes",
"foodbpass",
"foo.mp4",
"food",
"footprint",
"foodchain",
"foos",
"footmanpepe",
"foooood",
"foo.schemaname",
"foo.into",
"footwork",
"foo.count",
"fool",
"foo.c",
"foo2zjs",
"foo.uniquecol",
"foo.id",
"foods/milks",
"foo.a"
],
"results": [
{
"context": {},
"rank": 0.1,
"result": {
"age": 2330046478,
"content": {
"body": "`'{\"foo\": \"!'$1'\"}`",
"format": "org.matrix.custom.html",
"formatted_body": "'{"foo": "!'$1'"}",
"msgtype": "m.text"
},
"event_id": "$WWdy-eiCGjAOfpsHjU-ncDfwydvSq3lPufa8p0ROwyc",
"origin_server_ts": 1599765145421,
"room_id": "!OGEhHVWSdvArJzumhm:matrix.org",
"sender": "@tulir:maunium.net",
"type": "m.room.message",
"unsigned": {
"age": 2330046478
},
"user_id": "@tulir:maunium.net"
}
},
{
"context": {},
"rank": 0.1,
"result": {
"age": 3044675707,
"content": {
"body": "the only way I know of is to add it in the url bar: after `/#/room/!foo:bar`, add `?via=server.name`. It'll disappear immediately, but the join button will work after that",
"format": "org.matrix.custom.html",
"formatted_body": "the only way I know of is to add it in the url bar: after /#/room/!foo:bar, add ?via=server.name. It'll disappear immediately, but the join button will work after that",
"msgtype": "m.text"
},
"event_id": "$8j4j3L4Dq4lQXzEUTY7V2Qi2rKw-L0VwyIe6Y_qHFKk",
"origin_server_ts": 1599050516192,
"room_id": "!mjbDjyNsRXndKLkHIe:matrix.org",
"sender": "@tulir:maunium.net",
"type": "m.room.message",
"unsigned": {
"age": 3044675707
},
"user_id": "@tulir:maunium.net"
}
},
{
"context": {},
"rank": 0.1,
"result": {
"age": 5442219350,
"content": {
"body": "in the future it'll be `matrix:roomid/roomid:foo?via=server1.com&via=server2.org`",
"format": "org.matrix.custom.html",
"formatted_body": "in the future it'll be matrix:roomid/roomid:foo?via=server1.com&via=server2.org",
"msgtype": "m.text"
},
"event_id": "$eEekn1xkjg8JUHJRuRYH31VEDtiUXS2i00kR_-i2aWU",
"origin_server_ts": 1596652972549,
"room_id": "!mjbDjyNsRXndKLkHIe:matrix.org",
"sender": "@tulir:maunium.net",
"type": "m.room.message",
"unsigned": {
"age": 5442219350
},
"user_id": "@tulir:maunium.net"
}
}
]
}
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.