Browse SDKs · uni-app / uni-app x
Platform
SDKsuni-app / uni-app x

Search conversations

Perform a fuzzy keyword search across locally synchronized conversations by display name.

Copy

Invoke searchConversation() to perform a fuzzy search across the display names (showName) of conversations currently synchronized into the local database. Pass a non-empty keyword string; this method searches local storage and does not query remote server history for conversations not yet downloaded.

Parameters

ParameterTypeRequiredDescription
searchKeywordstringYesNon-empty text string matched against conversation display names.

Code example

import { searchConversation } from '@/uni_modules/unix-openim-sdk'

const result = await searchConversation(searchKeyword.trim())
const matchedConversations = result?.conversations ?? []
renderConversationResults(matchedConversations)

Return value

The Promise resolves with an OpenIMConversationListResult | null object. Matching conversation records are available in the conversations array (OpenIMConversationItem[]).

State changes after the call

This call is a local read-only query that reflects data stored at the time of invocation and does not trigger conversation events. If your search results UI needs to reflect ongoing conversation updates, listen to conversation events as shown in Retrieve conversation list and merge updates or deletions by conversationID.