Fix search human-mode output to match engine API response

The Go client struct expected a nested document object and top-level
page/section fields, but the engine returns flat results with metadata
in chunk_metadata. This caused empty display for title, type, tags,
page, and section in human output mode.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-02 16:17:35 +01:00
parent a6bab5e55e
commit 2d179af557
8 changed files with 174 additions and 33 deletions
+15 -13
View File
@@ -79,6 +79,12 @@ kb jobs --status failed --format json # filter by status
kb jobs <job_id> --format json # job details
```
## Examples
```bash
kb examples # show common usage examples
```
## Engine status and maintenance
```bash
@@ -102,18 +108,14 @@ All commands support:
{
"chunk_id": 1423,
"score": 0.031,
"score_breakdown": {"fts": 0.016, "vector": 0.015},
"text": "To install the latest version of git from source...",
"source": {
"document_id": 42,
"title": "Git Admin Guide",
"path": "/home/user/docs/git-admin.pdf",
"type": "pdf",
"page": 12,
"chunk_index": 3,
"total_chunks": 28,
"tags": ["git", "admin"]
}
"chunk_index": 3,
"chunk_metadata": {"page": 12},
"title": "Git Admin Guide",
"doc_type": "pdf",
"source_path": "/home/user/docs/git-admin.pdf",
"created_at": "2026-03-15T10:30:00",
"tags": ["git", "admin"]
}
],
"total_matches": 47,
@@ -160,7 +162,7 @@ Use filters when the question implies a specific domain:
- Always use `--format json` for machine parsing
- The `score` field is relative, not absolute — compare scores within a result set
- `source.page` is only present for PDF documents
- `source.section_header` is only present for markdown documents with headers
- `chunk_metadata.page` is only present for PDF documents
- `chunk_metadata.section_header` is only present for markdown documents with headers
- Results are already ranked by relevance (hybrid FTS + vector search)
- Duplicate files are detected at upload time (HTTP 409) — the client handles this gracefully