Add per-query search observability to /api/v1/catalog. The internal
CatalogSearchResult now carries Mode + SemanticUsed alongside the existing
Provider + FallbackReason; all four are plumbed through CatalogResult (which
previously dropped them in resolveDirectSearchSource) and exposed as an
additive, omitempty search_diagnostics object on the catalog response.
Two correctness points:
- For Meilisearch, Mode/SemanticUsed are derived from the POST-downgrade
request (baseSearchReq.Hybrid != nil) at the end of searchMeilisearch, so a
hybrid->keyword self-downgrade reports mode="keyword", semantic_used=false.
- search_diagnostics is emitted iff a provider search actually ran
(result.Provider != ""), which naturally omits browse, preview,
non-relevance-sort q=, and group=work paths (none set Provider).
API additive-only: existing response fields keep declaration order and stay
byte-stable; only the new omitempty field is added.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>