API 參考
檔案索引
分頁、排序查詢已建立的檔案索引,或統計相同查詢的符合數量。
卷扫描调度
volumeIdQUEUED顺序排队 · 同卷去重
RUNNING × 1同时只执行一个卷
完成 / 失败 / 停止 → 下一个卷
pause → PAUSED · resume → QUEUED
型別定義
graphql
type Subscription {
fileIndexScanProgressUpdated: FileIndexScanProgress!
}
type Query {
indexedFileCount(query: String!): Long!
indexedFiles(query: String!, offset: Int!, limit: Int!, sortBy: FileSortBy!): [File!]!
fileIndexDefaults: FileIndexDefaults!
fileIndexScanProgress(volumeId: ID): FileIndexScanProgress!
fileIndexVolumes: [FileIndexVolume!]!
}
type Mutation {
pauseFileIndex(volumeId: ID): Boolean!
rebuildFileIndex(volumeId: ID): Boolean!
resumeFileIndex(volumeId: ID): Boolean!
setFileIndexVolume(volumeId: ID!, input: FileIndexVolumeInput!): Boolean!
stopFileIndex(volumeId: ID): Boolean!
}
type File {
permission: String!
mediaId: ID
name: String!
path: String!
createdAt: Instant
updatedAt: Instant!
size: Long!
isDir: Boolean!
childCount: Int!
url: String!
isSystem: Boolean!
}
type FileIndexDefaults {
excludedDirs: [String!]!
excludedNames: [String!]!
excludedProfileDirs: [FileIndexProfileDir!]!
mediaExcludedDirSuffixes: [String!]!
}
enum FileIndexMode {
UNCONFIGURED
DISABLED
ALLOWLIST
BLOCKLIST
}
type FileIndexProfileDir {
profilesDir: String!
excludedDir: String!
exceptDirs: [String!]!
}
type FileIndexScanProgress {
volumeId: ID
indexed: Int!
pending: Int
total: Int
state: FileIndexScanState!
error: String
}
enum FileIndexScanState {
IDLE
QUEUED
RUNNING
PAUSED
STOPPED
FAILED
}
enum FileIndexScanStatus {
COMPLETED
CANCELED
FAILED
}
type FileIndexVolume {
id: ID!
path: String!
isAvailable: Boolean!
indexMode: FileIndexMode!
includedDirs: [String!]!
excludedDirs: [String!]!
lastScanAt: Instant
lastScanStatus: FileIndexScanStatus
lastScanCount: Long
lastScanTotal: Long
}
input FileIndexVolumeInput {
indexMode: FileIndexMode!
includedDirs: [String!]!
excludedDirs: [String!]!
}
enum FileSortBy {
UPDATED_AT_ASC
UPDATED_AT_DESC
SIZE_ASC
SIZE_DESC
NAME_ASC
NAME_DESC
}
scalar Instant
scalar Long操作
subscription
fileIndexScanProgressUpdated
接收檔案索引掃描進度更新。
graphql
subscription fileIndexScanProgressUpdated {
fileIndexScanProgressUpdated { volumeId indexed pending total state error }
}query
indexedFileCount
統計符合查詢條件的已索引檔案數。
graphql
query indexedFileCount($query: String!) {
indexedFileCount(query: $query)
}query
indexedFiles
用於跨磁碟區的全域檔案搜尋,支援分頁和排序。只查詢現有索引,不即時掃描磁碟;未索引的檔案不會回傳。
graphql
query indexedFiles($query: String!, $offset: Int!, $limit: Int!, $sortBy: FileSortBy!) {
indexedFiles(query: $query, offset: $offset, limit: $limit, sortBy: $sortBy) { permission mediaId name path createdAt updatedAt size isDir }
}mutation
pauseFileIndex
暫停正在進行的檔案索引掃描。
graphql
mutation pauseFileIndex($volumeId: ID) {
pauseFileIndex(volumeId: $volumeId)
}mutation
rebuildFileIndex
重建指定磁碟區的檔案索引;省略 volumeId 或傳入 null 時重建所有已設定磁碟區的索引。
graphql
mutation rebuildFileIndex($volumeId: ID) {
rebuildFileIndex(volumeId: $volumeId)
}mutation
resumeFileIndex
繼續已暫停的檔案索引掃描。
graphql
mutation resumeFileIndex($volumeId: ID) {
resumeFileIndex(volumeId: $volumeId)
}mutation
setFileIndexVolume
儲存磁碟區的索引模式與目錄設定,然後重新整理該磁碟區索引。
graphql
mutation setFileIndexVolume($volumeId: ID!, $input: FileIndexVolumeInput!) {
setFileIndexVolume(volumeId: $volumeId, input: $input)
}mutation
stopFileIndex
停止正在進行的檔案索引掃描。
graphql
mutation stopFileIndex($volumeId: ID) {
stopFileIndex(volumeId: $volumeId)
}query
fileIndexDefaults
讀取預設檔案索引設定。
graphql
query fileIndexDefaults {
fileIndexDefaults { excludedDirs excludedNames mediaExcludedDirSuffixes }
}query
fileIndexScanProgress
讀取目前檔案索引掃描進度。
graphql
query fileIndexScanProgress($volumeId: ID) {
fileIndexScanProgress(volumeId: $volumeId) { volumeId indexed pending total state error }
}query
fileIndexVolumes
讀取已註冊的檔案索引儲存磁碟區及其設定。
graphql
query fileIndexVolumes {
fileIndexVolumes { id path isAvailable indexMode includedDirs excludedDirs lastScanAt lastScanStatus }
}