searchMessages

public abstract void searchMessages(ConversationType conversationType, String targetId, String channelId, String keyword, int count, long beginTime, IRongCoreCallback.ResultCallback<List<Message>> resultCallback)

根据关键字搜索指定会话中的消息。

注意:如果需要自定义消息也能被搜索到,需要在自定义消息中实现 getSearchableWord 方法。超级群会话类型只支持搜索已存储到本地的消息。

Since

5.1.1

Parameters

conversationType

指定的会话类型。

targetId

指定的会话 id。

channelId

消息所属会话的业务标识。

keyword

搜索的关键字。

count

返回的搜索结果数量, 传 0 时会返回所有搜索到的消息, 非 0 时,逐页返回。

beginTime

查询 beginTime 之前的消息, 传 0 时从最新消息开始搜索,从该时间往前搜索。

resultCallback

搜索结果回调。


public abstract void searchMessages(ConversationType conversationType, String targetId, String channelId, String keyword, long startTime, long endTime, int offset, int limit, IRongCoreCallback.ResultCallback<List<Message>> resultCallback)

根据关键字,指定时间段搜索指定会话中的消息。

注意:如果需要自定义消息也能被搜索到,需要在自定义消息中实现 getSearchableWord 方法。超级群会话类型只支持搜索已存储到本地的消息。

Since

5.1.2

Parameters

conversationType

指定的会话类型。

targetId

指定的会话 id。

channelId

消息所属会话的业务标识。

keyword

搜索的关键字。

startTime

开始时间

endTime

结束时间

offset

偏移量

limit

返回的搜索结果数量,limit 需大于 0,最大值为 100,如果大于 100,会默认成 100

resultCallback

搜索结果回调。