fix: optimise OpenSearch query for merge suggestions (CM-1012)#3924
Merged
fix: optimise OpenSearch query for merge suggestions (CM-1012)#3924
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Optimizes OpenSearch merge-suggestion queries to reduce clause explosion and improve match precision/performance in the merge suggestions worker.
Changes:
- Added expansion caps for fuzzy queries (
max_expansions: 3) in both organization and member merge suggestions. - Limited organization prefix query expansion via
rewrite: 'top_terms_3'and reduced org identity query chunk size to 15. - Switched organization “weak identity” matching from
matchtomatch_phrase.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| services/apps/merge_suggestions_worker/src/activities/organizationMergeSuggestions.ts | Tightens org identity query construction (chunk size, fuzzy/prefix expansion limits, weak match change). |
| services/apps/merge_suggestions_worker/src/activities/memberMergeSuggestions.ts | Caps fuzzy query expansion to reduce query clause growth. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
services/apps/merge_suggestions_worker/src/activities/organizationMergeSuggestions.ts
Show resolved
Hide resolved
services/apps/merge_suggestions_worker/src/activities/organizationMergeSuggestions.ts
Show resolved
Hide resolved
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
…ssing Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
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.
Summary
max_expansions: 3rewrite: 'top_terms_3'to reduce clause growth100to75and reducing org identity chunk size from20to15nested_identities.string_valueNote
Medium Risk
Changes OpenSearch query construction for member/org merge suggestions (fuzzy/prefix expansion, chunking, normalization), which can affect both performance and which entities get suggested for merge. Adds a new Temporal workflow for testing org merge suggestions, but it’s non-production unless invoked explicitly.
Overview
Optimizes merge-suggestion OpenSearch queries to reduce clause explosion: caps fuzzy matching with
max_expansions: 3(members + orgs), constrains org prefix queries viarewrite: 'top_terms_3', and lowers org identity fan-out (process up to 75 identities, chunk size 15).Also normalizes cleaned org identity values to lowercase to better align with the index analyzer, and introduces a
testOrganizationMergeSuggestionsTemporal workflow (exported fromworkflows.ts) to fetch organizations by ID and log computed suggestions in parallel.Written by Cursor Bugbot for commit ee8cfa9. This will update automatically on new commits. Configure here.