feat: add populateEmbedding option to search and searchByEmbedding#70
Merged
Conversation
Adds an optional populateEmbedding flag (default false) to VectorSearchQuery and VectorSearchEmbeddingQuery, threaded through the search handlers and the DbAdapter.search signature into all three adapters (pg, cf, mongodb) so each result can include its embedding vector, mirroring findByIds. Also fixes the mongodb adapter's search wrapper, which dropped the argument before reaching searchImpl.
58436ec to
c1d1047
Compare
- Extract the duplicated pg parseEmbedding into a shared module imported by both search.ts and findByIds.ts. - Declare embedding?: number[] explicitly on VectorSearchResult and drop the `as number[]` casts from the populate-embedding tests. - Note in the HTTP search handler that populateEmbedding is intentionally programmatic-only.
- Root README: add populateEmbedding to the search/searchByEmbedding Local API params and note it is Local-API-only (the REST endpoint never returns vectors); fix the findByIds note that claimed search never returns the vector. - Adapters README: add populateEmbedding to the DbAdapter.search signature, search-path lifecycle, and method-reference row; add embedding? to the VectorSearchResult type; correct the EmbeddingRecord notes that said search never returns embeddings.
techiejd
added a commit
that referenced
this pull request
Jun 22, 2026
Consolidates the unreleased changes since 1.0.1 into one minor changeset: findByIds (#62), searchByEmbedding (#68), populateEmbedding (#70), and the mongodb search field-parity fix (#63). Also sets onlyUpdatePeerDependentsWhenOutOfRange so the fixed package group resolves to a minor (1.1.0) instead of a major peer-dependency cascade.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an optional
populateEmbedding?: boolean(defaultfalse) to bothVectorSearchQueryandVectorSearchEmbeddingQuery. Whentrue, each search result includes its embedding vector — mirroring the existing behavior offindByIds.Why
findByIdscan already return embeddings viapopulateEmbedding, butsearch/searchByEmbeddingcould not. This closes that gap so callers can retrieve vectors directly from a similarity search.Changes
End-to-end plumbing (default
false, so existing callers are unaffected):src/types.ts— added the flag to both query interfaces and to theDbAdapter.searchsignature.src/index.ts—search/searchByEmbeddingpass it through.src/endpoints/vectorSearch.ts— both handler signatures thread it toadapter.search(including the rerank path).embeddingcolumn and parses it.returnValues: trueand mapsmatch.values.embedding$projectexclusion and maps it.index.ts— fixed thesearchwrapper that dropped the new argument before reachingsearchImpl(otherwise the option would have been a silent no-op on mongodb).Not wired into the HTTP
requestHandler— this is the programmatic plumbing only.Tests
Added populate/omit coverage at each layer (core via
VectorizedPayload, plus pg/cf/mongodb adapter compliance + the cf unit mock). The mongodb tests poll for the eventually-consistent vector index before asserting.Full suites pass: CF 97 · PG 74 · mongodb 114 · core 96, zero failures; all packages typecheck clean.
Note
No changeset included — intentionally, to keep one minor changeset covering the stacked PRs rather than per-PR.