docs(files): unified file client + backends после #58–#61 (#53)
Release Please / Release Please (push) Skipped
Release / GoReleaser (push) Skipped
Tests / Secret scan (gitleaks) (push) Skipped
Tests / Test (Go 1.25) (push) Skipped
Tests / Test (Go stable) (push) Skipped

This commit is contained in:
2026-09-16 21:41:46 +00:00
parent 9b149281a8
commit b96c5c5361
4 changed files with 94 additions and 16 deletions
+26 -6
View File
@@ -690,12 +690,17 @@ See [`docs/elasticsearch.md`](docs/elasticsearch.md) for the tunnel setup.
```bash
oo search "Rechnung" # names only
oo search "Mahngebühr" --content # names + document text
oo search "Rechnung 2025" --substring # case-insensitive *term*, words ANDed
oo search "Rechnung" --folder 649 --limit 50
oo search "Rechnung" --json # shorthand for -o json
```
Flags: `--content`, `--substring`, `--folder ID` (folder subtree), `--limit N`,
`--backend oo|own`, `--json`.
Requires `ONLYOFFICE_ES_URL` (plus optional `ONLYOFFICE_ES_INDEX`,
`ONLYOFFICE_TENANT`).
`ONLYOFFICE_TENANT`). `TestIntegrationESFacadeUsesES` pins
`c.Files().Search()` to the ES backend (the REST `@search` only looks at names).
#### PDF/scans: own index (`oo index` + `--backend own`)
@@ -722,13 +727,22 @@ trade-offs.
All file backends (REST, WebDAV, read-only SQL, Elasticsearch) sit behind one
facade: `c.Files()` returns a `*FileClient` that also implements `FileStore`,
so old call sites keep working. Pick a transport per call with
`c.FileStore("rest"|"dav"|"pg"|"sql")` (SQL is read-only), open the SQL store
with `c.SQLFileStore()`, or register a backend on the facade
so old call sites keep working. Reads prefer SQL, then REST, then DAV; writes
go to REST/DAV. Pick a transport per call with
`c.FileStore("rest"|"dav"|"webdav"|"pg"|"sql"|"postgres"|"mysql")` (SQL is
read-only, `ErrReadOnly` on writes), open the SQL store with
`c.SQLFileStore()`, or register a backend on the facade
(`RegisterStore`/`RegisterSearcher`). Contract, model (`Entry`/`Kind`),
fallback rules, env names and how to add a backend:
[`docs/unified-file-client.md`](docs/unified-file-client.md).
- SQL (PostgreSQL/MySQL): `ONLYOFFICE_DSN` (or `ONLYOFFICE_PG_*` parts) —
[`docs/community-server-db.md`](docs/community-server-db.md).
- Elasticsearch: `ONLYOFFICE_ES_URL` — [`docs/elasticsearch.md`](docs/elasticsearch.md).
- Duplicate cleanup: `oo projects files dedupe PROJECT_ID` (`--apply`, `--cross`).
- Mount the Documents tree as a local FS (docker compose + FUSE):
`deploy/docker-compose.rclone-webdav.yml` — [`docs/rclone-webdav.md`](docs/rclone-webdav.md).
### Bulk tools (`cmd/`)
Small single-purpose binaries for bulk Documents work. All of them pace
@@ -765,8 +779,8 @@ kontolink IN.xlsx oo-index.tsv OUT.xlsx [FILE_ID] [AMOUNTS_TSV]
| `docs` | `tools`, `convert`, `optimize`, `ocr`, `hocr`, `as-md`, `put-md`, `put-txt`, `put-xlsx` |
| `catalog` | `match`, `merge`, `apply`, `scan-contacts`, `scan-projects`, `scan-thunderbird` |
| `dav` | `ls`, `move`, `copy`, `mkdir`, `rename-file`, `rename-folder`, `download`, `fileops` |
| `search` | `QUERY` (`--content`, `--folder ID`, `--limit N`, `--backend oo\|own`, `--json`) |
| `index` | `folder FOLDER_ID`, `files FILE_ID...` (`--recursive`, `--exts pdf`, `--limit N`, `--dry-run`) |
| `search` | `QUERY` (`--content`, `--substring`, `--folder ID`, `--limit N`, `--backend oo\|own`, `--json`) |
| `index` | `folder FOLDER_ID`, `files FILE_ID...` (`--recursive`, `--exts pdf`, `--limit N`, `--workers N`, `--lang deu+eng`, `--min-chars N`, `--work-dir DIR`, `--backend rest\|dav`, `--dry-run`, `--json`) |
The CLI reads only `.env` from the current working directory (godotenv is a
CLI-only concern — the library itself never loads dotfiles).
@@ -999,6 +1013,12 @@ oo projects files list 33
| `ONLYOFFICE_CALENDAR_ID` | Default calendar id used when omitted (default `1`) |
| `ONLYOFFICE_PROJECT_ID` | Default project id used when omitted (default `33`) |
| `OO_URL`, `OO_USER`, `OO_PASS` | Optional CLI-only aliases for `ONLYOFFICE_*` |
| `ONLYOFFICE_ES_URL`, `ONLYOFFICE_ES_INDEX`, `ONLYOFFICE_TENANT` | Elasticsearch search (`oo search`, `oo index`) — [docs/elasticsearch.md](docs/elasticsearch.md) |
| `ONLYOFFICE_ES_TEXT_INDEX` | Own PDF/scan index (default `oo_docs_text`) |
| `ONLYOFFICE_DSN`, `ONLYOFFICE_PG_DRIVER`, `ONLYOFFICE_PG_TENANT`, `ONLYOFFICE_PG_*` | Read-only SQL store — [docs/community-server-db.md](docs/community-server-db.md) |
| `MINIO_ENDPOINT`, `MINIO_BUCKET`, `MINIO_ACCESS_KEY`, `MINIO_SECRET_KEY` | SQL `Download` / portal S3 fallback |
| `ONLYOFFICE_DOCS_URL`, `ONLYOFFICE_DOCS_SECRET` | Optional Document Server for `office` DOCX preview |
| `ONLYOFFICE_WEBDAV_URL`, `ONLYOFFICE_USER`, `ONLYOFFICE_PASSWORD` | rclone WebDAV mount — [docs/rclone-webdav.md](docs/rclone-webdav.md) |
Mail and CRM cleanup are documented in [oo CLI use cases](#oo-cli-use-cases) above. Personal disk inventory / dossier sync lives in the private `oo-workspace` (`oow`) tooling.