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
搜索结果回调。
public abstract void searchMessages( ConversationIdentifier conversationIdentifier, String keyword, Array<String> objectNameList, int limit, long startTime, IRongCoreCallback.ResultCallback<List<Message>> resultCallback)
根据关键字搜索指定会话中,指定消息类型的本地历史消息
此方法允许应用根据关键词、对象名列表、时间范围等条件在一个特定对话中搜索消息。搜索结果将通过回调方式返回。
Since
5.8.1
Parameters
conversationIdentifier
会话类型、会话 ID
keyword
关键字,非空
objectNameList
消息类型数组,支持传入多个,如(文本: "RC:TxtMsg")
limit
最大的查询数量[最大 100,超过则使用 100]
startTime
查询 startTime 之前的消息(传 0 表示从最新消息开始搜索),单位:毫秒
resultCallback
搜索结果的回调接口。成功时返回消息列表,失败时返回错误信息。