Skip to content

feat: native vector search support - #90

Open
rebasedming wants to merge 2 commits into
paradedb-amfrom
vector-search
Open

feat: native vector search support#90
rebasedming wants to merge 2 commits into
paradedb-amfrom
vector-search

Conversation

@rebasedming

Copy link
Copy Markdown

What

Implements paradedb/paradedb#5685: native vector search support with no Pgvector/Pgvector.EntityFrameworkCore dependency.

  • HasVectorType(n) property mapping for pgvector vector(n) on float[], including migration DDL and round-trip serialization via a minimal Npgsql binary converter (plugin-registered on EF9/10, GlobalTypeMapper on EF8)
  • EF.Functions.L2Distance/CosineDistance/InnerProduct translating to <->/<=>/<#> with parameterized query vectors
  • Bm25IndexBuilder.HasField(x => x.Embedding, VectorMetric.Cosine) emitting vector opclasses inside USING bm25 DDL
  • HybridRrf example migrated off pgvector-dotnet; new VectorSearch example; vector-in-bm25 integration tests capability-gated until released

Why

ParadeDB indexes pgvector columns inside the bm25 index, so users should get the full query surface from this package alone.

Tests

net8.0/net9.0/net10.0 each: 114 passed, 2 skipped (capability-gated) against a live Testcontainer. csharpier/api-coverage/codespell/markdownlint clean.

Note: on EF9/10 the type converter auto-registers when the provider builds the data source; users passing a pre-built NpgsqlDataSource need manual setup (same caveat as pgvector-dotnet).

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.30556% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.65%. Comparing base (d7abdf3) to head (f6a9110).

Files with missing lines Patch % Lines
src/Internal/Storage/PdbVectorConverter.cs 30.00% 24 Missing and 4 partials ⚠️
src/Internal/Storage/PdbVectorTypeMapping.cs 78.94% 4 Missing ⚠️
...rc/Internal/Metadata/ParadeDbAnnotationProvider.cs 80.00% 1 Missing and 1 partial ⚠️
src/VectorMetric.cs 71.42% 1 Missing and 1 partial ⚠️
src/Internal/Query/Translator.cs 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff               @@
##           paradedb-am      #90      +/-   ##
===============================================
- Coverage        92.15%   89.65%   -2.50%     
===============================================
  Files               26       33       +7     
  Lines              854      996     +142     
  Branches           105      126      +21     
===============================================
+ Hits               787      893     +106     
- Misses              27       56      +29     
- Partials            40       47       +7     
Flag Coverage Δ
net10.0 89.61% <73.57%> (-2.54%) ⬇️
net8.0 89.60% <73.38%> (-2.55%) ⬇️
net9.0 89.61% <73.57%> (-2.54%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...sions/ParadeDbDbContextOptionsBuilderExtensions.cs 100.00% <100.00%> (ø)
src/Extensions/ParadeDbIndexBuilderExtensions.cs 97.97% <100.00%> (+0.38%) ⬆️
...rc/Extensions/ParadeDbPropertyBuilderExtensions.cs 100.00% <100.00%> (ø)
.../Internal/ParadeDbDataSourceConfigurationPlugin.cs 100.00% <100.00%> (ø)
src/Internal/ParadeDbOptionsExtension.cs 96.66% <100.00%> (+1.21%) ⬆️
...nternal/Storage/ParadeDbTypeMappingSourcePlugin.cs 100.00% <100.00%> (ø)
src/Internal/Storage/PdbTypeMappings.cs 100.00% <100.00%> (ø)
...ternal/Storage/PdbVectorTypeInfoResolverFactory.cs 100.00% <100.00%> (ø)
src/Internal/Query/Translator.cs 93.80% <94.11%> (+0.01%) ⬆️
...rc/Internal/Metadata/ParadeDbAnnotationProvider.cs 86.51% <80.00%> (+0.09%) ⬆️
... and 3 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread examples/README.md Outdated
## Vector Search (`examples/VectorSearch`)

Runs Top-K nearest-neighbor queries over a pgvector column with the native
vector support, backed by a bm25 index when the server supports it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vector support, backed by a bm25 index when the server supports it.
ParadeDB vector support, backed by a bm25 index when the server supports it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just so it's clearer

Comment thread scripts/run_examples.sh
Autocomplete
MoreLikeThis
HybridRrf
VectorSearch

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the other ORMs I see you put VectorSearch below Rag. I think it looks better above, but that's a nit

Comment thread README.md
@@ -47,13 +47,57 @@ The official [Entity Framework Core](https://learn.microsoft.com/en-us/ef/core/)
| ParadeDB | 0.23.0+ |
| PostgreSQL | 15+ (with ParadeDB extension) |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add pgvector as a requirement in these tables?

Comment thread README.md Outdated
| ParadeDB | 0.23.0+ |
| PostgreSQL | 15+ (with ParadeDB extension) |

## Vector Search

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is useful, but I don't know if code snippets make sense in the top-level README. Imo instead we should add an extra sentence at line 39, which explains that we do full-text and vector search, and that vector search indexes pgvector types

@rebasedming
rebasedming changed the base branch from main to paradedb-am July 27, 2026 15:37
Comment on lines 48 to +51
await db.Database.ExecuteSqlRawAsync("DROP INDEX IF EXISTS mock_items_bm25_idx");
// The VectorSearch example may have left its own index behind, and newer
// pg_search versions allow only one ParadeDB index per table
await db.Database.ExecuteSqlRawAsync("DROP INDEX IF EXISTS mock_items_vector_idx");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update all examples to use one index name between them. Maybe search_idx so it's not bm25 or vector specific. Then we don't need to have a separate drop command

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.

3 participants