tencent cloud

Smart Media Hosting

Product Introduction
Product Overview
Feature Description
Product Strengths
Use Cases
Basic Concept
Purchase Guide
Quick Start
Create Media Library
Initiate request
Service Level API Document
History
Introduction
API Category
Making API Requests
PaaS Service APIs
Official Cloud Disk APIs
Data Types
Error Codes
Business Level API Document
Introduction
Access Token Operation API
Tenant Space Operation API
File Operation API
Directory or Album Operation API
Recycle Bin Operation API
Quota Operation API
Query Task Operation API
Search Operation API
Historical Version Operations API
Directory and File Batch Operation API
Collection Operation API
Error Codes
SDK Documentation
Android SDK
iOS SDK
HarmonyOS SDK
FAQs
Enterprise Network Disk
Product Introduction
Purchase Guide
Quick Start
FAQs
Service Level Agreement
Glossary

Search

PDF
フォーカスモード
フォントサイズ
最終更新日: 2026-01-07 10:49:14

Introduction

This document provides an introduction to search-related APIs and example code.

Search Directory and File

Feature Description

Searching directories and files.

Sample Code

try{
let result = await SMHSearchApis.initSearchTask({
libraryId:"libraryId",
spaceId:"spaceId",
keyword:"1"
});
}catch(e){
// Exception handling
}


Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtained after creating a media library in the media hosting console. Please see create media library
String
Yes
spaceId
Space ID. If the media library is in single-tenant mode, this parameter is fixed as hyphen (`-`). If the media library is in multi-tenant mode, you must specify this parameter. Please refer to create tenant space.
String
No
keyword
Search keywords. Use spaces to separate multiple keywords. The relationship between keywords is "OR" with priority display for items matching more keywords.
String
No
scope
Search scope, specify the directory to search (optional parameter). For example, to search the root directory, specify an empty string, "/", or leave this field unspecified.
String
No
extname
Get the file extension
String array
No
type
Search type, with negation support (!). Supported types include:
all: Search all types of files and folders. Defaults to all when type is not specified or empty. Use !all to exclude.
dir: Search directories only, excluding files. Use !dir to exclude.
file: Search files only, excluding directories. Use !file to exclude.
doc, xls, or ppt: Search Word, Excel, or PowerPoint documents only, with corresponding file extensions .doc(x), .xls(x), or .ppt(x). Use !doc, !xls, or !ppt to exclude.
pdf or txt: Search PDF or plain text documents only, with file extensions .pdf or .txt. Use !pdf or !txt to exclude.
image, video, or audio: Only search for files of image, video, or audio type. The corresponding file MIME (Content Type) are image/, video/, or audio/*. For exclusion, use !image, !video, or !audio.
PowerPoint: Search presentation files only, such as .ppt, .pptx, .pot, .potx. Use !powerpoint to exclude.
excel: Search spreadsheet files only, such as .xls, .xlsx, .ett, .xltx, .csv. Use !excel to exclude.
word: Search document files only, such as .doc, .docx, .dot, .wps, .wpt. Use !word to exclude.
text: Search plain text files only, such as .txt, .asp, .htm. Use !text to exclude.
SMHFileInfoSelectType array
No
minFileSize
Search file size range (minimum), unit Byte
Number
No
maxFileSize
Search file size range (maximum), unit Byte
Number
No
modificationTimeStart
Search update time range (starting), irrelevant to time zone

No
modificationTimeEnd
Search update time range (ending), irrelevant to time zone

No
orderBy
Sorting field, currently supported by name, modification time, file size, creation time. Specific type as follows:
name: sort by name
modificationTime: sort by last modified
size: sort by file size
creationTime: sort by creation time
localCreationTime: sort by local creation time
localModificationTime: sort by local modification time
SMHFileListOrderBy
No
orderByType
Sorting method, ascending as asc, descending as desc
SMHOrderByType
No
searchMode
Search method, fast for fast, normal for normal, default normal
SMHSearchMode
No
labels
Search file tag
String array
No
categories
Search file custom category info
String array
No
withInode
Whether to return the inode (file directory ID) after upload
Bool
No
withFavoriteStatus
Whether to return the favorite status
Bool
No

Continuing to Retrieve Search Results

Feature Description

Use to continue the search result.

Sample Code

try{
let result = await SMHSearchApis.resumeSearchTask({
libraryId:"libraryId",
spaceId:"spaceId",
searchId:"searchId",
marker:"marker"
});
}catch(e){
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtained after creating a media library in the media hosting console. Please see create media library
String
Yes
spaceId
Space ID. If the media library is in single-tenant mode, this parameter is fixed as hyphen (`-`). If the media library is in multi-tenant mode, you must specify this parameter. Please refer to create tenant space.
String
No
searchId
Search task ID
String
Yes
marker
pagination identifier, the nextMarker field returned when creating a search task or continuing to retrieve search results, required parameter
String
Yes
withInode
Whether to return the inode (file directory ID) after upload
Bool
No
withFavoriteStatus
Whether to return the favorite status
Bool
No

Delete Search Task

Feature Description

Used to delete a search task.

Sample Code

try{
let result = await SMHSearchApis.deleteSearchTask({
libraryId:"libraryId",
spaceId:"spaceId",
searchId:"searchId"
});
}catch(e){
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtained after creating a media library in the media hosting console. Please see create media library
String
Yes
spaceId
Space ID. If the media library is in single-tenant mode, this parameter is fixed as hyphen (`-`). If the media library is in multi-tenant mode, you must specify this parameter. Please refer to create tenant space.
String
No
searchId
Search task ID
String
Yes

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック