-
Couldn't load subscription status.
- Fork 149
chore: check that a vector search index exists with indexCheck #693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds validation to check that a vector search index exists before executing aggregate queries that use $vectorSearch, preventing errors from being thrown during query execution. This validation is controlled by the indexCheck configuration option.
Key Changes:
- Added
indexExistsmethod toVectorSearchEmbeddingsManagerto verify index existence - Modified
AggregateToolto validate vector search indexes before executing aggregation pipelines - Added integration test to verify error handling when a non-existent vector search index is referenced
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/common/search/vectorSearchEmbeddingsManager.ts | Added indexExists method to check if a vector search index exists in the database |
| src/tools/mongodb/read/aggregate.ts | Added isVectorSearchIndexUsed method and index validation logic that throws an error when a non-existent vector search index is referenced |
| tests/integration/tools/mongodb/read/aggregate.test.ts | Added test case to verify error handling for non-existent vector search indexes and enabled indexCheck in test configuration |
Co-authored-by: Copilot <[email protected]>
Pull Request Test Coverage Report for Build 18871399446Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
src/tools/mongodb/read/aggregate.ts
Outdated
| const indexExists = await this.session.vectorSearchEmbeddingsManager.indexExists({ | ||
| database, | ||
| collection, | ||
| indexName, | ||
| }); | ||
|
|
||
| return indexExists; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const indexExists = await this.session.vectorSearchEmbeddingsManager.indexExists({ | |
| database, | |
| collection, | |
| indexName, | |
| }); | |
| return indexExists; | |
| return await this.session.vectorSearchEmbeddingsManager.indexExists({ | |
| database, | |
| collection, | |
| indexName, | |
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect we'd get an error from the server if we try to use $vectorSearch
https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/#fields
🥲 |
Proposed changes
Checklist