Count decreases when paging with RSM
Closed this issue · 0 comments
Fishbowler commented
When using a simple date query, and using RSM to limit and page through the results, the count of total matches decreases as I page through.
First query:
<iq to="chat@conference.example.org" id="test1" type="set">
<query xmlns='urn:xmpp:mam:2' queryid='00003'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE'>
<value>urn:xmpp:mam:2</value>
</field>
<field var='start'>
<value>2020-01-20T00:00:00.000+00:00</value>
</field>
</x>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>1</max>
</set>
</query>
</iq>
First response:
<message to="userone@example.org/Spark" from="chat@conference.example.org">
<result xmlns="urn:xmpp:mam:2" queryid="00003" id="1">
<forwarded xmlns="urn:xmpp:forward:0">
<delay xmlns="urn:xmpp:delay" stamp="2020-01-20T20:47:21.102Z"/>
<message xmlns="jabber:client" type="groupchat" from="chat@conference.example.org">
<subject/>
</message>
</forwarded>
</result>
</message>
<iq type="result" id="test1" from="chat@conference.example.org" to="userone@example.org/Spark">
<fin xmlns="urn:xmpp:mam:2" queryid="00003">
<set xmlns="http://jabber.org/protocol/rsm">
<count>8</count>
</set>
</fin>
</iq>
(note the RSM count is 8)
Second query (for page 2 - 1 item after the item with ID "1"):
<iq to="chat@conference.example.org" id="test1" type="set">
<query xmlns='urn:xmpp:mam:2' queryid='00004'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE'>
<value>urn:xmpp:mam:2</value>
</field>
<field var='start'>
<value>2020-01-20T00:00:00.000+00:00</value>
</field>
</x>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>1</max>
<after>1</after>
</set>
</query>
</iq>
Second response:
<message to="userone@example.org/Spark" from="chat@conference.example.org">
<result xmlns="urn:xmpp:mam:2" queryid="00004" id="2">
<forwarded xmlns="urn:xmpp:forward:0">
<delay xmlns="urn:xmpp:delay" stamp="2020-01-20T20:48:28.301Z"/>
<message xmlns="jabber:client" id="98EDg-107" type="groupchat" from="chat@conference.example.org/XMPP">
<body>Potato</body>
<x xmlns="jabber:x:event">
<offline/>
<delivered/>
<displayed/>
<composing/>
</x>
<stanza-id xmlns="urn:xmpp:sid:0" id="9a959885-0356-4c58-a7a7-bf6f6e75161a" by="chat@conference.example.org"></stanza-id>
</message>
</forwarded>
</result>
</message>
<iq type="result" id="test1" from="chat@conference.example.org" to="userone@example.org/Spark">
<fin xmlns="urn:xmpp:mam:2" queryid="00004">
<set xmlns="http://jabber.org/protocol/rsm">
<first>9a959885-0356-4c58-a7a7-bf6f6e75161a</first>
<count>7</count>
</set>
</fin>
</iq>
See that count had reduced to 7.
This doesn't occur when performing a full text search - this remains at the correct count throughout.