tencent cloud

Smart Media Hosting

Search

PDF
Modo Foco
Tamanho da Fonte
Última atualização: 2026-01-07 10:49:08

Introduction

This document provides an overview of APIs and SDK example code for searching files and directories.
API
Operation Description
Search directories and files
Used to continue retrieving search results
Used to delete search task

SDK API Reference

For specific parameters and method descriptions of all SDK APIs, please see SDK API Reference.

Search Directory and File

Feature Description

Initialize search, a certain number of search results may be returned.

Sample Code

QCloudSMHInitiateSearchRequest *req = [QCloudSMHInitiateSearchRequest new];
// Media Library ID, required parameter
req.libraryId = @"libraryId"
// Space ID, if the media library is in single-tenant mode, this parameter is fixed as a hyphen (-); if the media library is in multi-tenant mode, you must specify this parameter
req.spaceId = @"spaceId";
// Search scope, specify the directory to search, for example, to search the root directory, you can specify an empty string, "/", or leave the field unspecified
req.scope = scopeDir.totalPath;
// Search keywords, multiple keywords can be separated by spaces, the relationship between keywords is "OR" with priority display of projects matching more keywords;
req.keyword = @"keyWord";
// Search type, string or string array QCloudSMHSearchType
req.searchTypes = @[@(type)];
[req setFinishBlock:^(QCloudSMHSearchListInfo *_Nullable result, NSError *_Nullable error) {

}];
[[QCloudSMHService defaultSMHService] initSearch:req];

Continue Retrieving Search Results

Feature Description

Continue retrieving search results.

Sample Code

QCloudSMHResumeSearchRequest *req = [QCloudSMHResumeSearchRequest new];
// Media Library ID, required parameter
req.libraryId = self.userModel.libraryId;
// Space ID, if the media library is in single-tenant mode, this parameter is fixed as a hyphen (-); if the media library is in multi-tenant mode, you must specify this parameter
req.spaceId = scopeDir.teamInfo.spaceId;
// Search task ID returned during search initialization
req.searchId = searchId;
// Pagination identifier, the nextMarker field returned when creating a search task or continuing to retrieve search results;
req.nextMarker = nextMarker;
[req setFinishBlock:^(QCloudSMHSearchListInfo *_Nullable result, NSError *_Nullable error) {

}];
[[QCloudSMHService defaultSMHService] resumeSearch:req];

Deleting a Search

Feature Description

Used to delete search task.

Sample Code

QCloudSMHAbortSearchRequest *req = [QCloudSMHAbortSearchRequest new];
// Media Library ID, required parameter
req.libraryId = self.userModel.libraryId;
// Space ID, if the media library is in single-tenant mode, this parameter is fixed as a hyphen (-); if the media library is in multi-tenant mode, you must specify this parameter
req.spaceId = scopeDir.teamInfo.spaceId;
// Search task ID
req.searchId = @"searchId";
[req setFinishBlock:^(QCloudSMHSearchListInfo *_Nullable result, NSError *_Nullable error) {
if (error) {
[liveData postError:error];
return;
} else {
[liveData postValueAndComplete:searchId];
}
}];
[[QCloudSMHService defaultSMHService] abortSearch:req];


Ajuda e Suporte

Esta página foi útil?

comentários