PlainApp
API 参考

文件索引

分页、排序查询已建立的文件索引,或统计同一查询的匹配数量。

卷扫描调度

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 }
}