searchMessages

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

Searches for messages in a specified conversation based on a keyword.

Note: To make custom messages searchable, implement the getSearchableWord method in your custom message class. For ultra group conversations, only messages stored locally can be searched.

Since

5.1.1

Parameters

conversationType

The type of the specified conversation.

targetId

The ID of the specified conversation.

channelId

The business identifier of the conversation to which the message belongs.

keyword

The keyword to search for.

count

The number of search results to return. Pass 0 to return all matching messages; otherwise, results are returned page by page.

beginTime

Search for messages before this timestamp. Pass 0 to start searching from the latest message and move backward in time.

resultCallback

Callback for search results.


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)

Searches for messages in a specified conversation within a given time range based on keywords.

Note: To make custom messages searchable, implement the getSearchableWord method in your custom message class. For ultra group conversations, only locally stored messages can be searched.

Since

5.1.2

Parameters

conversationType

The specified conversation type.

targetId

The specified conversation ID.

channelId

The business identifier of the conversation to which the message belongs.

keyword

The search keyword.

startTime

The start time of the search range.

endTime

The end time of the search range.

offset

The offset for pagination.

limit

The number of search results to return. Must be greater than 0, with a maximum value of 100. If greater than 100, it will default to 100.

resultCallback

Callback for search results.


public abstract void searchMessages(ConversationIdentifier conversationIdentifier, String keyword, Array<String> objectNameList, int limit, long startTime, IRongCoreCallback.ResultCallback<List<Message>> resultCallback)

Searches for local historical messages of specified message types in a specific conversation based on keywords

This method allows applications to search for messages in a specific conversation based on conditions such as keywords, object name lists, and time ranges. The search results will be returned via a callback.

Since

5.8.1

Parameters

conversationIdentifier

Conversation type and conversation ID

keyword

Keyword, cannot be empty

objectNameList

Array of message types, supports multiple entries (e.g., text: RC:TxtMsg)

limit

Maximum number of queries [maximum 100, if exceeded, 100 will be used]

startTime

Query messages before startTime (pass 0 to start searching from the latest message), unit: milliseconds

resultCallback

Callback interface for search results. Returns a message list on success, or an error message on failure.