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

If conversationID is null, the messages in all conversations will be searched.

If conversationID is not null, the messages of a specific conversation will be searched. You need to pass in the 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

Specify the keywords (max 5). If neither the sender nor message type is specified, the keyword list cannot be empty.

◆ setKeywordListMatchType()

void setKeywordListMatchType ( int  type)
inline

Whether to combine the keywords with OR (V2TIM_KEYWORD_LIST_MATCH_TYPE_OR) or AND (V2TIM_KEYWORD_LIST_MATCH_TYPE_AND). The default is OR.

◆ setSenderUserIDList()

void setSenderUserIDList ( List< String >  userIDList)
inline

Specify the senders (max 5 user IDs)

◆ 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

Specify the start time for search. The default value is 0, indicating the current time. You can also set it to a UTC timestamp, in seconds.

◆ setSearchTimePeriod()

void setSearchTimePeriod ( long  searchTimePeriod)
inline

Set the time range (seconds) for search. The default value 0 indicates the time range is not limited. If you set it to 24x60x60, messages in the past day will be searched.

◆ setPageSize()

void setPageSize ( int  pageSize)
inline

Set the maximum number of results returned per page. This is used to paginate search results. If you set the parameter to 0, the results will not be paginated. Please note that the search performance may be compromised if you do not paginate search results when there are too many of them.

Attention
Valid only for interface searchLocalMessages

◆ setPageIndex()

void setPageIndex ( int  pageIndex)
inline

Specify the page number (which starts from 0). This is used to paginate search results. For example, to return 10 results per page, you can do the following:

  • For the first call, set pageSize to 10 and pageIndex to 0. totalCount in the callback indicates the total number of search results.
  • You can then calculate the total number of pages: totalPage = (totalCount % pageSize == 0) ? (totalCount / pageSize) : (totalCount / pageSize + 1)
  • For subsequent calls, you can specify a page number (must be smaller than totalPage) so that the results on that page will be returned.
Attention
Valid only for interface searchLocalMessages

◆ setSearchCount()

void setSearchCount ( int  searchCount)
inline

Set the number of results returned per cloud search

Attention
Valid only for interface searchCloudMessages

◆ setSearchCursor()

void setSearchCursor ( String  searchCursor)
inline

Set the starting position for a cloud search. For the first call, leave the parameter empty. For subsequent calls, pass in the value of searchCursor in V2TIMMessageSearchResult.

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