searchLocalMessages
Introduction
Search message form local app
Can only search in local.
This method only works with Ultimate Edition, you can find the pricing plan here.
Searching for the Messages in All the Conversations
Searching for the Messages in the Specified Conversation
Typical Use Cases for the Search
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
searchParam | V2TimMessageSearchParam | yes | The search parameter. |
Returned template
V2TimValueCallback<V2TimMessageSearchResult>
{
code : number
desc : string
data : {
messageSearchResultItems : V2TimMessageSearchResultItem[]// The list of search result messages.
totalCount : number // The amount of results.
}
}
Return value details
name | type | description |
---|---|---|
code | number | Request result: Error codes. 0 means success. |
desc | string | The description of the error. It will be empty if success. |
data | V2TimMessageSearchResult | The list of search result messages. |
Code example
import { TencentImSDKPlugin } from 'react-native-tim-js';
const searchLocalMessagesRes = await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.searchLocalMessages({
conversationID: '',
keywordList: [],
type: 0,
userIDList: [],
messageTypeList: [],
searchTimePeriod: 0,
searchTimePosition: 0,
pageIndex: 0,
pageSize: 10,
});
if (searchLocalMessagesRes.code === 0) {
}