Skip to content

feat(search): public anonymous semantic_search over content corpus (#2246) - #2253

Merged
jung-thomas merged 3 commits into
DEVfrom
worktree-semantic-search-2246
Sep 11, 2026
Merged

jung-thomas merged 3 commits into
DEVfrom
worktree-semantic-search-2246

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Closes #2246.

What

Public, anonymous semantic/vector search — an HTTP function semantic_search on SearchService plus a matching MCP tool — over the existing tutorial/concept/external embedding corpus.

Contract (non-negotiable): the caller sends TEXT; the server embeds it server-side (embedding-client.embed()) and returns scored content references only — never raw embedding vectors, never accepts a caller-supplied vector.

Scope

  • semanticSearchEnabled ChatSettings flag, default OFF → 503 when off; registered in feature-flags/registry.js.
  • Corpora: tutorials | concepts | external | all (cosine over stored Vector(1536); HANA COSINE_SIMILARITY raw-SQL / SQLite JS-cosine).
  • topK clamped [1,50]; minScore default from ChatSettings; query embedding cached by hash(query+model).
  • Per-IP rate limiter (429) reusing the DB-backed SearchSettings budget.
  • MCP manifest tool entry + @requires:'any' CDS function; wire shape = {slug,title,stepNumber,snippet,score,url,contentType}.

Tests

  • test/unit/semantic-search.test.js — core module: corpus routing, topK clamp, minScore floor, wire shape (no vectors), embed-once + query cache.
  • test/unit/semantic-search-handler.test.js — service handler: 503 gate, scored refs when enabled, 429 rate limit.
  • test/unit/mcp-contract.test.js — anonymous-tool contract updated.
  • Full unit suite green except pre-existing fresh-worktree env gaps (hugo-apps deps, srv-qa/lib/parsers.bundle.mjs build artifact, app graph deps) — unrelated to this change.

Notes

  • Caches (ChatSettings, rate limiter, embed test hook, cache handle) live on globalThis symbols to survive the Windows Vitest served-vs-imported module duplication.
  • srv-qa cp-list audit: no mta.yaml change — content-store.js doesn't reach the new files and srv-qa serves its own minimal search-service.cds.

…2246)

Expose an anonymous HTTP function + MCP tool on SearchService that embeds
caller TEXT server-side and returns scored content references only — never
raw vectors, never accepts a caller-supplied vector.

- semanticSearchEnabled ChatSettings flag (default OFF; 503 when off),
  registered in feature-flags/registry.js
- corpora: tutorials | concepts | external | all (cosine over stored
  Vector(1536); HANA COSINE_SIMILARITY, SQLite JS-cosine)
- topK clamped [1,50]; minScore default from ChatSettings; query-embedding
  cached by hash(query+model)
- per-IP rate limiter (429) reusing DB-backed SearchSettings budget
- MCP manifest tool entry + @requires:'any' CDS function
- unit + handler tests (SQLite); caches on globalThis to survive Windows
  Vitest module duplication across served vs imported instances
…ch-2246

# Conflicts:
#	test/unit/mcp-contract.test.js
@jung-thomas
jung-thomas merged commit e0f1c5b into DEV Sep 11, 2026
7 checks passed
@jung-thomas
jung-thomas deleted the worktree-semantic-search-2246 branch September 11, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant