Skip to content

Fix search (and vector search) index errors - #6153

Merged
jamis merged 4 commits into
mongodb:masterfrom
jamis:fix-search-index-errors
May 28, 2026
Merged

Fix search (and vector search) index errors#6153
jamis merged 4 commits into
mongodb:masterfrom
jamis:fix-search-index-errors

Conversation

@jamis

@jamis jamis commented May 27, 2026

Copy link
Copy Markdown
Contributor

Fixes a few errors in tests with search and vector search tests; also fixes an issue with vector_search and auto_embed_search due to filter being used instead of a separate $match stage.

Copilot AI review requested due to automatic review settings May 27, 2026 20:47
@jamis
jamis requested a review from a team as a code owner May 27, 2026 20:47
@jamis
jamis requested a review from comandeo-mongo May 27, 2026 20:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 addresses failing search/vector-search specs and adjusts instance-level vector search query construction to avoid using $vectorSearch.filter for “exclude self”, instead applying self-exclusion via a separate $match stage.

Changes:

  • Extend test client configuration to pass direct_connection when provided by the URI.
  • Make search-index specs more robust against Atlas-normalized index definitions and index ordering differences.
  • Update #vector_search / #auto_embed_search instance pipelines to exclude the source document post-search and add targeted unit tests for the constructed aggregation pipeline.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
spec/spec_helper.rb Passes direct_connection from the configured MongoDB URI into the test client options.
spec/mongoid/search_indexable_spec.rb Adds pipeline-construction unit tests; makes Atlas integration expectations more tolerant of server normalization and ordering.
lib/mongoid/search_indexable.rb Refactors instance-level vector search to use a post-search $match for self-exclusion and over-fetches by 1 to avoid short counts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/mongoid/search_indexable.rb
Comment thread lib/mongoid/search_indexable.rb

@comandeo-mongo comandeo-mongo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🥇

@jamis jamis added the bug Fixes a bug, with no new features or broken compatibility label May 28, 2026
@jamis
jamis merged commit 0a04a76 into mongodb:master May 28, 2026
76 checks passed
@jamis
jamis deleted the fix-search-index-errors branch May 28, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes a bug, with no new features or broken compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants