searchMessages

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

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

Note: To enable custom messages to be searchable, implement the getSearchableWord method in your custom message class.

Since

5.0.0

Parameters

conversationType

Specifies the conversation type.

targetId

Specifies the conversation ID.

keyword

The keyword to search for.

count

The number of search results to return. Pass 0 to return all matched messages; otherwise, results are returned paginated.

beginTime

Specifies the timestamp to start searching from. Pass 0 to search from the latest message and move backward.

resultCallback

Callback for handling search results.


public abstract void searchMessages(ConversationType conversationType, String targetId, 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.

Since

5.1.2

Parameters

conversationType

Specifies the conversation type.

targetId

Specifies the conversation ID.

keyword

The keyword to search for.

startTime

The start time of the search range.

endTime

The end time of the search range.

offset

The offset for pagination.

limit

The maximum 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 the 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 within a specific conversation based on criteria such as keywords, object name lists, and time range. The search results are returned via a callback.

Since

5.8.1

Parameters

conversationIdentifier

The conversation type and conversation ID.

keyword

The keyword to search for (non-empty).

objectNameList

An array of message types, supporting multiple types (e.g., text: RC:TxtMsg).

limit

The maximum number of messages to query [maximum 100; if exceeded, 100 is used].

startTime

The timestamp to search for messages before this time (pass 0 to start searching from the latest message), in milliseconds.

resultCallback

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