Seach message platform api reverse flag is not working

hi sendbird.

I’m following the doc to implement my search message function.

when i send request via v3/search/messages with parameter reverse = true and reverse = false in group channel. But I retrieve the message in same order.

May I know how to get message with in the order of time?

Hi @Tim_Wei,

Welcome to the Sendbird Community. Looking at the two methods, they are by default inverse of each other.

/v3/message/search

  • True = Ascending order
  • False = Descending order (Default)

/v3/{channel_type}/{channel_url}/messages

  • True = Descending Order
  • False = Ascending Order (Default)

In both cases, messages are ordered by time. The difference being where the start is, the oldest or newest.

Hi @Tyler ,

i did some test below,

/v3/search/messages?channel_url={channel_url}&query=a&limit=2&reverse=true
first message “created_at”: 1620412003729,
second message “created_at”: 1620412033419,

/v3/search/messages?channel_url={channel_url}&query=a&limit=2&reverse=false
first message “created_at”: 1620412003729,
second message “created_at”: 1620412019481,

the result looks like has same order, both start message are the oldest.

thanks

Hi @Tim_Wei,

That is expected behavior. True for Search and False for Group_Channel is the same order. You can refer to my previous post to see that order.

Hi @Tyler ,

I can not understand, In my test, I use the same platform API /v3/search/messages with different query parameter reverse.

thanks

Ah, my apologies. I overlooked the actual URL on the second query. Allow me some time to investigate.

Hi @Tim_Wei,

I tested this on a few of my own channels and was not able to reproduce the behavior. When I flip the reverse flag, I get items in a different order. Could you DM me the following items so I can try and reproduce this?

  • Application ID
  • Secondary API Token (So it can be revoked after testing)
  • Channel URL
  • Query parameter

Thanks,
Tyler