file-search-system 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- file_search_system-1.0.0/.gitignore +26 -0
- file_search_system-1.0.0/LICENSE +33 -0
- file_search_system-1.0.0/PKG-INFO +381 -0
- file_search_system-1.0.0/README.md +357 -0
- file_search_system-1.0.0/config.ini +39 -0
- file_search_system-1.0.0/file_search/__init__.py +73 -0
- file_search_system-1.0.0/file_search/__main__.py +6 -0
- file_search_system-1.0.0/file_search/_engine/Everything.exe +0 -0
- file_search_system-1.0.0/file_search/_engine/License.txt +52 -0
- file_search_system-1.0.0/file_search/_engine/SDK/dll/Everything32.dll +0 -0
- file_search_system-1.0.0/file_search/_engine/SDK/dll/Everything64.dll +0 -0
- file_search_system-1.0.0/file_search/_engine/SDK/dll/EverythingARM.dll +0 -0
- file_search_system-1.0.0/file_search/_engine/SDK/dll/EverythingARM64.dll +0 -0
- file_search_system-1.0.0/file_search/cli.py +833 -0
- file_search_system-1.0.0/file_search/manager.py +2533 -0
- file_search_system-1.0.0/file_search/paths.py +149 -0
- file_search_system-1.0.0/file_search/scanner.py +467 -0
- file_search_system-1.0.0/file_search/sdk.py +1498 -0
- file_search_system-1.0.0/file_search/server.py +378 -0
- file_search_system-1.0.0/main.py +16 -0
- file_search_system-1.0.0/pyproject.toml +65 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Python 生成物
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
|
|
9
|
+
# 虚拟环境
|
|
10
|
+
.venv/
|
|
11
|
+
|
|
12
|
+
# 运行时状态(Everything 引擎产物,随机器生成,不入库)
|
|
13
|
+
bin/Everything.db
|
|
14
|
+
bin/Everything.ini
|
|
15
|
+
bin/*.tmp
|
|
16
|
+
bin/snapshot.efu
|
|
17
|
+
Test/_regression.log
|
|
18
|
+
Test/_stress_tree/
|
|
19
|
+
|
|
20
|
+
# 安装验证的临时环境与工作区(跑完即删)
|
|
21
|
+
_env_pip/
|
|
22
|
+
_env_uv/
|
|
23
|
+
_work_pip/
|
|
24
|
+
_work_uv/
|
|
25
|
+
*.log
|
|
26
|
+
_pypi_upload_check/
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 file-search-system contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
-------------------------------------------------------------------------------
|
|
24
|
+
Third-party components bundled in the wheel (file_search/_engine/)
|
|
25
|
+
|
|
26
|
+
Everything - https://www.voidtools.com/
|
|
27
|
+
Copyright (C) 2018 David Carpenter
|
|
28
|
+
MIT License (see file_search/_engine/License.txt)
|
|
29
|
+
Files: _engine/Everything.exe, _engine/SDK/dll/Everything*.dll
|
|
30
|
+
|
|
31
|
+
PCRE (bundled inside Everything.exe)
|
|
32
|
+
Copyright (c) 1997-2012 University of Cambridge
|
|
33
|
+
BSD 3-Clause (see file_search/_engine/License.txt)
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: file-search-system
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: 基于 Everything 的本地毫秒级文件搜索系统:Python 库 + 全功能 CLI + HTTP JSON API(非管理员文件夹索引、junction 死循环免疫、非阻塞搜索)
|
|
5
|
+
Project-URL: Documentation, https://pypi.org/project/file-search-system/
|
|
6
|
+
Project-URL: Source, https://pypi.org/project/file-search-system/
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: cli,desktop-search,everything,file-index,file-search,http-api,indexer,search,windows
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Desktop Environment
|
|
20
|
+
Classifier: Topic :: System :: Filesystems
|
|
21
|
+
Classifier: Topic :: Utilities
|
|
22
|
+
Requires-Python: >=3.12
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# file-search-system v1.0.0
|
|
26
|
+
|
|
27
|
+
基于 [Everything](https://www.voidtools.com/) 的本地毫秒级文件搜索系统。
|
|
28
|
+
纯 Python 标准库(`ctypes`)零依赖;非管理员文件夹索引(NTFS / ReFS /
|
|
29
|
+
FAT32 / exFAT / 可移动盘 / 网络共享);Everything 后台静默运行(无窗口、
|
|
30
|
+
无托盘、便携模式);全部能力经 CLI / Python / HTTP 三种接口提供。
|
|
31
|
+
|
|
32
|
+
- 环境要求:Windows 8.1+(推荐 Win10/11)· Python 3.12+
|
|
33
|
+
- 自带引擎:`pip install` / `uv add` 装完即用,无需单独安装 Everything
|
|
34
|
+
- 搜索语法即 Everything 官方语法:`ext:` `size:` `dm:` `path:` …
|
|
35
|
+
<https://www.voidtools.com/support/everything/searching/>
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 安装
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install file-search-system
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
uv add file-search-system
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
装好即带 Windows 版 Everything 引擎(`Everything.exe` + 四架构 SDK DLL),
|
|
50
|
+
首次运行自动就绪,无需另行下载。
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
file-search init # 一次性初始化:定位引擎 + 配置 + 静默拉起 + 就绪
|
|
54
|
+
file-search "README" -n 5 # 立刻可用
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 引擎与配置落在哪里
|
|
58
|
+
|
|
59
|
+
| 安装方式 | 引擎目录(`Everything.exe` + DLL) | 配置文件 |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| `pip` / `uv` 安装 | `%LOCALAPPDATA%\file-search-system\bin`(首次使用自动落地) | `%LOCALAPPDATA%\file-search-system\config.ini` |
|
|
62
|
+
| 源码运行 | `<项目根>\bin` | `<项目根>\config.ini` |
|
|
63
|
+
|
|
64
|
+
原因是 Everything 的便携模式必须在 `Everything.exe` 旁写
|
|
65
|
+
`Everything.ini` / `Everything.db`,而安装目录通常不可写,所以首次使用会把
|
|
66
|
+
引擎释放到用户可写目录,之后一直复用该副本。
|
|
67
|
+
|
|
68
|
+
自定义位置(任选其一):
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
set FILE_SEARCH_BIN=D:\my-everything\bin # 指定引擎目录(bin_dir= 参数同义)
|
|
72
|
+
set FILE_SEARCH_HOME=D:\my-data # 指定引擎落地与配置目录
|
|
73
|
+
set FILE_SEARCH_DATA=D:\my-data # 只指定 config.ini 所在目录
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
查看实际路径、或把自带引擎导出到任意目录:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
file-search engine info # 显示引擎 / DLL / 配置文件的实际位置
|
|
80
|
+
file-search engine install D:\my-app\bin # 复制一份自带引擎过去(独立分发用)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 运行要求与安全说明
|
|
84
|
+
|
|
85
|
+
- 需要 Windows 与可运行的 Everything 引擎;非 Windows 平台会在导入时给出
|
|
86
|
+
明确报错。
|
|
87
|
+
- 本系统内部所有"重启/关闭引擎"的路径(`shutdown` / `set_config` 重启 /
|
|
88
|
+
看门狗恢复 / `kill_own_process`)都与查询串行,引擎死亡瞬间无在途查询。
|
|
89
|
+
若**外部**(任务管理器、`taskkill /F`)恰在查询在途时强杀引擎,SDK DLL
|
|
90
|
+
内部锁会被卡死线程持有,宿主的 Python 进程需要重启(`is_running` 会探测
|
|
91
|
+
到并告警)。
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 一、CLI
|
|
96
|
+
|
|
97
|
+
### 搜索
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
file-search search "关键词" [选项] # search 可省略
|
|
101
|
+
file-search "ext:py size:>10mb" # 等价写法
|
|
102
|
+
file-search "*.pdf" --paths-only -n 20
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
| 选项 | 说明 |
|
|
106
|
+
|---|---|
|
|
107
|
+
| `-n, --max N` | 最多返回 N 条 |
|
|
108
|
+
| `--offset N` | 跳过前 N 条(分页;须 ≥0) |
|
|
109
|
+
| `--sort KEY` | 排序:`size-desc`、`date-modified-desc`、`name-asc` 等 |
|
|
110
|
+
| `--regex` | 按正则解析搜索词 |
|
|
111
|
+
| `--case` | 大小写敏感 |
|
|
112
|
+
| `--whole-word` | 全字匹配 |
|
|
113
|
+
| `--match-path` | 匹配整个路径(默认只匹配文件名) |
|
|
114
|
+
| `--highlight` | 输出高亮字段(匹配段以 `*` 包裹) |
|
|
115
|
+
| `--paths-only` | 每行只输出完整路径(便于管道) |
|
|
116
|
+
| `--json` | JSON 输出 |
|
|
117
|
+
| `--export FMT --out FILE` | 导出 `csv` / `json` / `txt` / `efu` |
|
|
118
|
+
| `--timeout 秒` | 查询保护超时(默认 15) |
|
|
119
|
+
| `--wait-index 秒` | 索引扫描中的等待秒数(0=立即报错并显示进度) |
|
|
120
|
+
| `--no-start` | Everything 未运行时不自动启动 |
|
|
121
|
+
|
|
122
|
+
### 索引管理
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
file-search index add "D:\docs" "E:\media" # 添加目录(立即返回,后台扫描)
|
|
126
|
+
file-search index add --disks C D # 整盘
|
|
127
|
+
file-search index add "D:\data" --exclude temp # 自定义排除目录
|
|
128
|
+
file-search index add "D:\data" --prescan # 预扫描 junction(最安全,较慢)
|
|
129
|
+
file-search index add "D:\data" --no-monitor # 不实时监控变化(更省资源)
|
|
130
|
+
file-search index snapshot "E:\backup" # EFU 快照模式(秒级加载)
|
|
131
|
+
file-search index status [--wait 300] # 扫描进度(可等待完成)
|
|
132
|
+
file-search index list # 当前索引配置(写法 -> 本机展开)
|
|
133
|
+
file-search index defaults # 预览默认目录发现(不改动)
|
|
134
|
+
file-search index disks # 本机磁盘(盘符/类型/文件系统)
|
|
135
|
+
file-search index network [--add] # 发现网络共享(--add 加入索引)
|
|
136
|
+
file-search index remove "E:\media" # 移除目录
|
|
137
|
+
file-search index clear # 清空索引
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
`index add` 参数:`--disks`(整盘列表)、`--exclude`(排除目录名)、
|
|
141
|
+
`--exclude-files`(排除文件通配)、`--prescan` / `--no-prescan`、
|
|
142
|
+
`--monitor` / `--no-monitor`。默认排除 `node_modules / .pnpm / .git /
|
|
143
|
+
__pycache__`。
|
|
144
|
+
|
|
145
|
+
### 其他命令
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
file-search init # 初始化(幂等:配置+拉起+就绪)
|
|
149
|
+
file-search status # 运行/就绪/索引/OS 兼容等级
|
|
150
|
+
file-search compat # 本机兼容体检(10 项只读)
|
|
151
|
+
file-search config list [前缀] # 引擎键列表
|
|
152
|
+
file-search config get 键1 键2 # 读引擎键
|
|
153
|
+
file-search config set 键=值 [键=值...] # 写引擎键并重启生效
|
|
154
|
+
file-search runcount get "C:\a.exe" # 运行次数 get / inc / set
|
|
155
|
+
file-search runcount inc "C:\a.exe"
|
|
156
|
+
file-search runcount set "C:\a.exe" 5
|
|
157
|
+
file-search db save # 数据库 save / rebuild /
|
|
158
|
+
file-search db rebuild # update-folders /
|
|
159
|
+
file-search db run-history-delete # run-history-save / delete
|
|
160
|
+
file-search serve --host 0.0.0.0 --port 8465 # HTTP 服务(见第三节)
|
|
161
|
+
file-search engine info|install # 引擎目录查看 / 导出
|
|
162
|
+
file-search exit [--force] # 退出 Everything
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
`python -m file_search` 与 `file-search` 等价。
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 二、Python 库
|
|
170
|
+
|
|
171
|
+
### 导入与初始化
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
from file_search import EverythingManager
|
|
175
|
+
|
|
176
|
+
mgr = EverythingManager() # 构造零副作用;首条命令自动完成启动链
|
|
177
|
+
info = mgr.init() # 或显式初始化(幂等),返回状态摘要
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**构造参数:**
|
|
181
|
+
|
|
182
|
+
| 参数 | 默认 | 说明 |
|
|
183
|
+
|---|---|---|
|
|
184
|
+
| `bin_dir` | `None` | 直接指定 bin 目录 |
|
|
185
|
+
| `base_dir` | `None` | 项目根目录(其下应有 `bin/`) |
|
|
186
|
+
| `dll_path` | `None` | SDK DLL 路径(`None` = 自动按解释器架构选择 x64/x86/ARM64/ARM) |
|
|
187
|
+
| `exe_path` | `None` | Everything.exe 路径(默认 `<bin>/Everything.exe`) |
|
|
188
|
+
| `startup_timeout` | `60.0` | 等待启动(IPC 可达)的秒数 |
|
|
189
|
+
|
|
190
|
+
自动定位优先级:`bin_dir` 参数 → `FILE_SEARCH_BIN` 环境变量 →
|
|
191
|
+
`base_dir/bin` → 源码树 `<项目根>/bin` → 用户数据目录(首次自动释放引擎)。
|
|
192
|
+
|
|
193
|
+
### 搜索
|
|
194
|
+
|
|
195
|
+
```python
|
|
196
|
+
results = mgr.search("*.pdf size:>1mb", max_results=50, sort="date-modified")
|
|
197
|
+
for r in results:
|
|
198
|
+
print(r["full_path"], r["size"], r["date_modified"])
|
|
199
|
+
|
|
200
|
+
total = mgr.last_total_for_thread() # 本次查询的总命中数(并发安全)
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**`search()` / `submit_search()` 参数:**
|
|
204
|
+
|
|
205
|
+
| 参数 | 默认 | 说明 |
|
|
206
|
+
|---|---|---|
|
|
207
|
+
| `search_string` | 必填 | Everything 搜索语法文本 |
|
|
208
|
+
| `max_results` | `None` | 最多返回条数(`None` = 不限;`<1` 抛 `ValueError`) |
|
|
209
|
+
| `offset` | `0` | 跳过前 N 条(分页;负值抛 `ValueError`) |
|
|
210
|
+
| `sort` | `None` | `SORT_NAMES` 键名(如 `"size-desc"`)或 `EVERYTHING_SORT_*` 常量 |
|
|
211
|
+
| `match_path` | `False` | 匹配整个路径 |
|
|
212
|
+
| `match_case` | `False` | 大小写敏感 |
|
|
213
|
+
| `match_whole_word` | `False` | 全字匹配 |
|
|
214
|
+
| `regex` | `False` | 搜索词按正则解析 |
|
|
215
|
+
| `request_flags` | `REQUEST_ALL` | 请求字段位掩码(请求了才出现在结果里) |
|
|
216
|
+
| `query_timeout` | `15.0` | 查询保护超时秒数 |
|
|
217
|
+
| `wait_for_index` | `0.0` | 索引扫描中的等待秒数;`0` = 抛 `IndexScanningError` |
|
|
218
|
+
|
|
219
|
+
**结果字段**(按 `request_flags`):`full_path`、`file_name`、`path`、
|
|
220
|
+
`extension`、`size`、`date_created/modified/accessed/run/recently_changed`、
|
|
221
|
+
`attributes` + `attributes_str`、`cloud_only`(OneDrive 云占位)、
|
|
222
|
+
`run_count`、`is_file/folder/volume`;高亮三字段需显式请求。
|
|
223
|
+
|
|
224
|
+
### 非阻塞搜索
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
h = mgr.submit_search("ext:log", max_results=100) # 立即返回,绝不阻塞
|
|
228
|
+
if h.wait(3.0): # 最多等 3 秒
|
|
229
|
+
for r in h.results():
|
|
230
|
+
print(r["full_path"])
|
|
231
|
+
else:
|
|
232
|
+
print(h.status()) # {"state": "pending"|"scanning"|"complete"|...}
|
|
233
|
+
|
|
234
|
+
# 句柄方法:done() / wait(秒) / results() / status() / cancel()
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### 索引与生命周期
|
|
238
|
+
|
|
239
|
+
```python
|
|
240
|
+
mgr.index_add([r"D:\docs"], excludes=["temp"], monitor=True) # live 索引
|
|
241
|
+
mgr.index_snapshot([r"E:\backup"]) # EFU 快照
|
|
242
|
+
mgr.index_remove([r"D:\docs"])
|
|
243
|
+
mgr.index_clear()
|
|
244
|
+
mgr.prescan_junctions([r"F:\Data"]) # 并行 junction 预扫描
|
|
245
|
+
mgr.wait_index_stable(timeout=600) # 等扫描完成
|
|
246
|
+
mgr.export("*.md", "out.csv", fmt="csv")# 导出 csv/json/txt/efu
|
|
247
|
+
|
|
248
|
+
mgr.start() # 静默启动(未运行时)
|
|
249
|
+
mgr.status() # 完整状态 dict
|
|
250
|
+
mgr.shutdown(force=True) # 用完即关
|
|
251
|
+
mgr.cleanup() # 关闭自启实例 + 释放 SDK
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
默认退出语义为**长驻**(Python 结束后 Everything 留守,下次毫秒级可用);
|
|
255
|
+
`shutdown(force=True)` 为用完即关。
|
|
256
|
+
|
|
257
|
+
外部应用自带引擎时,可先用 CLI 复制一份再显式指定:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
file-search engine install D:\my-app\bin
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
```python
|
|
264
|
+
mgr = EverythingManager(bin_dir=r"D:\my-app\bin")
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## 三、HTTP API
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
file-search serve # 默认 127.0.0.1:8465
|
|
273
|
+
file-search serve --host 0.0.0.0 --port 8465 # 对外暴露(建议加 token)
|
|
274
|
+
file-search serve --token my-secret # 令牌鉴权
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
所有端点在启用令牌后须带 `X-Api-Token` 头(不符 → 401)。
|
|
278
|
+
|
|
279
|
+
**端点:**
|
|
280
|
+
|
|
281
|
+
| 方法 | 路径 | 说明 |
|
|
282
|
+
|---|---|---|
|
|
283
|
+
| GET | `/health` | 存活与就绪探针 |
|
|
284
|
+
| GET | `/status` | 完整状态(JSON) |
|
|
285
|
+
| GET | `/search` | 阻塞搜索 |
|
|
286
|
+
| GET | `/search/submit` | 非阻塞搜索(返回 id) |
|
|
287
|
+
| GET | `/search/result` | 轮询非阻塞结果 |
|
|
288
|
+
| GET | `/index` | 当前索引配置 |
|
|
289
|
+
| POST | `/init` | 触发初始化(幂等) |
|
|
290
|
+
| POST | `/index/add` | 添加索引目录(后台生效) |
|
|
291
|
+
| POST | `/index/clear` | 清空索引 |
|
|
292
|
+
| GET | `/config?key=...` | 读引擎键(无 key = 全部) |
|
|
293
|
+
| POST | `/config` | 写引擎键(`{"settings": {...}, "restart": true}`) |
|
|
294
|
+
| GET | `/runcount?path=...` | 读取运行次数 |
|
|
295
|
+
| POST | `/runcount` | 运行次数操作(get / inc / set) |
|
|
296
|
+
| POST | `/exit` | 退出 Everything |
|
|
297
|
+
|
|
298
|
+
**请求示例:**
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
curl "http://127.0.0.1:8465/search?q=ext:pdf&max=20&sort=size-desc"
|
|
302
|
+
curl -H "X-Api-Token: my-secret" "http://127.0.0.1:8465/search?q=readme"
|
|
303
|
+
|
|
304
|
+
# /search 参数:q, max(≤10000), offset(≥0), sort, regex, case,
|
|
305
|
+
# whole-word, match-path, timeout, wait_index
|
|
306
|
+
|
|
307
|
+
curl "http://127.0.0.1:8465/search/submit?q=readme&max=10"
|
|
308
|
+
# -> {"id": "e3ecfb87..."}
|
|
309
|
+
curl "http://127.0.0.1:8465/search/result?id=e3ecfb87..."
|
|
310
|
+
# -> {"status": {"state": "complete"}, "results": [...]}
|
|
311
|
+
|
|
312
|
+
curl -X POST "http://127.0.0.1:8465/index/add" \
|
|
313
|
+
-H "Content-Type: application/json" \
|
|
314
|
+
-d '{"folders": ["D:\\docs"], "monitor": true}'
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
内置限制:请求体 ≤ 1 MiB(413)、搜索串 ≤ 8192 字符与 `max` ≤ 10000(400)、
|
|
318
|
+
非阻塞句柄注册表 ≤ 4096(429)。
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## 四、config.ini(唯一配置文件)
|
|
323
|
+
|
|
324
|
+
三节结构,每键带注释,可手编(支持记事本 UTF-8 BOM);程序改写时注释
|
|
325
|
+
自动再生、原子写不损坏。默认位置见上文"引擎与配置落在哪里",
|
|
326
|
+
也可用 `FILE_SEARCH_HOME` 指定目录。
|
|
327
|
+
|
|
328
|
+
```ini
|
|
329
|
+
[index]
|
|
330
|
+
# live = 实时文件夹索引(默认);snapshot = EFU 快照(秒级加载,静态)
|
|
331
|
+
mode = live
|
|
332
|
+
# 索引目录列表(逗号分隔;支持 %ENV% 变量与相对路径 = 跨设备可移植;
|
|
333
|
+
# 留空 = init() 自动采用默认:用户数据目录 + 全部非系统盘)
|
|
334
|
+
folders =
|
|
335
|
+
# 按目录名排除(node_modules/.pnpm 是 junction 雷区,必须排除)
|
|
336
|
+
excludes = node_modules,.pnpm,.git,__pycache__
|
|
337
|
+
# 按文件通配符排除(如 *.log,*.tmp)
|
|
338
|
+
exclude_files =
|
|
339
|
+
# 1 = 实时监控目录变化;0 = 仅启动时扫描(更省资源)
|
|
340
|
+
monitor = 1
|
|
341
|
+
# snapshot 模式的 EFU 文件路径(index snapshot 自动生成维护)
|
|
342
|
+
efu =
|
|
343
|
+
|
|
344
|
+
[engine]
|
|
345
|
+
# Everything 引擎高级键(config set 写入;手编前先 config list 确认键名)
|
|
346
|
+
# 示例(去掉行首 # 即生效):
|
|
347
|
+
# exclude_hidden_files_and_folders = 1
|
|
348
|
+
# exclude_system_files_and_folders = 1
|
|
349
|
+
# db_location =
|
|
350
|
+
# language = 0
|
|
351
|
+
|
|
352
|
+
[server]
|
|
353
|
+
# serve 监听地址(对外暴露请配 0.0.0.0 并启用 token)
|
|
354
|
+
host = 127.0.0.1
|
|
355
|
+
# serve 监听端口(CLI --host/--port 可临时覆盖)
|
|
356
|
+
port = 8465
|
|
357
|
+
# API 令牌:非空时所有 HTTP 请求须带 X-Api-Token 头(留空 = 本机免鉴权)
|
|
358
|
+
token =
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
引擎目录下的 `Everything.ini`(739 键)才是引擎实际生效文件,由系统从
|
|
362
|
+
`config.ini` 自动生成维护,**不要手编**。受管键(索引五键 + 无 GUI 四键)
|
|
363
|
+
禁止经 `[engine]` 改写。
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
## 项目结构
|
|
368
|
+
|
|
369
|
+
```
|
|
370
|
+
file_search/ # Python 包
|
|
371
|
+
├── sdk.py # Everything SDK 逐函数封装(80+ 方法)
|
|
372
|
+
├── manager.py # 生命周期 / 索引配置 / 非阻塞搜索 / 看门狗
|
|
373
|
+
├── scanner.py # 并行 junction 免疫扫描器 + EFU 生成
|
|
374
|
+
├── server.py # HTTP JSON API
|
|
375
|
+
├── cli.py # 全功能命令行
|
|
376
|
+
├── paths.py # 引擎与配置定位 / 引擎释放
|
|
377
|
+
└── _engine/ # 自带 Everything 引擎(exe + 四架构 SDK DLL)
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
`_engine/` 内的 Everything 与 SDK 为 voidtools 的 MIT 许可
|
|
381
|
+
(见 `_engine/License.txt`),随本包一并分发。
|