Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Search conversations

Search local conversation records matching keyword strings in display names.

Copy

Perform full-text keyword searches across locally synchronized conversation titles and remarks:

Code example

import sdk, { SearchConversationReq, SearchConversationResp } from '@openimsdk/imsdk';

const request: SearchConversationReq = {
  searchParam: keyword.trim(),
};
const response: SearchConversationResp = await sdk.searchConversation(request);
renderConversationResults(response.conversationList);

Parameters

ParameterTypeRequiredDescription
searchParamstringYesSearch keyword string.

Return value

Returns a Promise that resolves to a SearchConversationResp object:

PropertyTypeDescription
conversationListIMConversation[]List of matched conversation records from local storage.

State changes after the call

Search executes purely against the local SQLite database; it does not issue remote server requests. Update matching search results when real-time conversation changes arrive by checking conversationID. For conversation event listeners, see Retrieve conversation list.