IMSDK
IM features a comprehensive suite of solutions including global access, one-to-one chat, group chat, message push, profile and relationship chain hosting, and account authentication. It also provides complete app access and backend management APIs.
V2TIMMessageSearchParam

Public Member Functions

void setConversationID (String conversationID)
 
void setKeywordList (List< String > keywordList)
 
void setKeywordListMatchType (int type)
 
void setSenderUserIDList (List< String > userIDList)
 
void setMessageTypeList (List< Integer > messageTypeList)
 
void setSearchTimePosition (long searchTimePosition)
 
void setSearchTimePeriod (long searchTimePeriod)
 
void setPageSize (int pageSize)
 
void setPageIndex (int pageIndex)
 
void setSearchCount (int searchCount)
 
void setSearchCursor (String searchCursor)
 
int getPageIndex ()
 
int getPageSize ()
 
List< String > getKeywordList ()
 
List< Integer > getMessageTypeList ()
 
long getSearchTimePosition ()
 
long getSearchTimePeriod ()
 

Static Public Attributes

static final int V2TIM_KEYWORD_LIST_MATCH_TYPE_OR = 0
 
static final int V2TIM_KEYWORD_LIST_MATCH_TYPE_AND = 1
 

Member Function Documentation

◆ setConversationID()

void setConversationID ( String  conversationID)
inline

Search all conversations or a specified conversation

conversationID == null: search all conversations

conversationID != null: search a specified conversation. Unique ID of a conversation. For one-to-one chats, the value format is String.format("c2c_%s", "userID"). For group chats, the value format is String.format("group_%s", "groupID").

◆ setKeywordList()

void setKeywordList ( List< String >  keywordList)
inline

The keyword list can contain up to 5 keywords. When the sender and type of the message are not specified, the keyword list must be non-empty. Otherwise, the keyword list can be empty.

◆ setKeywordListMatchType()

void setKeywordListMatchType ( int  type)
inline

Set the keyword list matching type, which can be the OR or AND relationship search. The options are V2TIM_KEYWORD_LIST_MATCH_TYPE_OR (default) and V2TIM_KEYWORD_LIST_MATCH_TYPE_AND.

◆ setSenderUserIDList()

void setSenderUserIDList ( List< String >  userIDList)
inline

Set userIDs for message sending. Up to 5 userIDs are supported.

◆ setMessageTypeList()

void setMessageTypeList ( List< Integer >  messageTypeList)
inline

Set the message types to search. If null is passed in, all message types supported are searched (V2TIMFaceElem and V2TIMGroupTipsElem are not supported).

◆ setSearchTimePosition()

void setSearchTimePosition ( long  searchTimePosition)
inline

Start time for search. The default value is 0, indicating to start search now. The value can also be the UTC timestamp, in seconds.

◆ setSearchTimePeriod()

void setSearchTimePeriod ( long  searchTimePeriod)
inline

A time period in the past starting from the start time, in seconds. The default value 0 indicates that the time range is not limited. The value 24x60x60 indicates the past day.

◆ setPageSize()

void setPageSize ( int  pageSize)
inline

Count of results per page: used for the paginated display of the search results. If you do not want to paginate the search results, set the parameter to 0. However, a large count of search results without pagination may cause performance issues.

Attention
Valid only for interface searchLocalMessages

◆ setPageIndex()

void setPageIndex ( int  pageIndex)
inline

Page number: used for the paginated display of the search results. Page numbers must start from 0. For example, to display 10 results per page, call the API according to the following rules:

  • First call: call searchLocalMessage with pageSize being set to 10 and pageIndex to 0. Then you can get the total number of results from totalCount in the callback.
  • Page quantity calculation: totalPage = (totalCount % pageSize == 0) ? (totalCount / pageSize) : (totalCount / pageSize + 1)
  • Second call: specify pageIndex (pageIndex < totalPage) to return the subsequent page number.
Attention
Valid only for interface searchLocalMessages

◆ setSearchCount()

void setSearchCount ( int  searchCount)
inline

Set the count of cloud search results.

Attention
Valid only for interface searchCloudMessages

◆ setSearchCursor()

void setSearchCursor ( String  searchCursor)
inline

Set the starting position for cloud search. Set an empty string for the first time, and pass in the value of searchCursor in V2TIMMessageSearchResult when continuing to search.

Attention
Valid only for interface searchCloudMessages

◆ getPageIndex()

int getPageIndex ( )
inline

◆ getPageSize()

int getPageSize ( )
inline

◆ getKeywordList()

List<String> getKeywordList ( )
inline

◆ getMessageTypeList()

List<Integer> getMessageTypeList ( )
inline

◆ getSearchTimePosition()

long getSearchTimePosition ( )
inline

◆ getSearchTimePeriod()

long getSearchTimePeriod ( )
inline

Field Documentation

◆ V2TIM_KEYWORD_LIST_MATCH_TYPE_OR

final int V2TIM_KEYWORD_LIST_MATCH_TYPE_OR = 0
static

◆ V2TIM_KEYWORD_LIST_MATCH_TYPE_AND

final int V2TIM_KEYWORD_LIST_MATCH_TYPE_AND = 1
static