Repository navigation
[Cosmos] Use deterministic ordinal ranks for hybrid-search RRF - #50940
Draft
Maya Painter (Maya-Painter) wants to merge 5 commits into
Draft
Maya Painter (Maya-Painter) wants to merge 5 commits into
Maya Painter (Maya-Painter) wants to merge 5 commits into
Conversation
Port ordinal and opt-in competition ranking with cached numeric document RID tie-breaking and offline regression coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 29c3522f-9887-43c5-bebb-f42ee9ba4d51
|
Azure Pipelines: Successfully started running 2 pipeline(s). 34 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Derive strict fusion expectations from standalone component queries and numeric document RIDs. Allow only zero-score title ties to vary in non-RRF queries, and use cleanup-compliant test database creation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 29c3522f-9887-43c5-bebb-f42ee9ba4d51
Keep the full-text reference setup and numeric RID tie-break expression on single lines as requested. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 29c3522f-9887-43c5-bebb-f42ee9ba4d51
Restore private ranking helpers and replace implementation-coupled unit tests with public-query integration coverage for ordinal and competition ranks, numeric RID ties, weights, and paging. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 29c3522f-9887-43c5-bebb-f42ee9ba4d51
Move ordinal and competition ranking coverage into HybridSearchQueryTest, reuse its database lifecycle, and remove the obsolete emulator ignore gate. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 29c3522f-9887-43c5-bebb-f42ee9ba4d51
| import static org.assertj.core.api.Assertions.assertThat; | ||
| import static org.assertj.core.api.Assertions.fail; | ||
|
|
||
| @Ignore("TODO: Ignore these test cases until the public emulator is released.") |
There was a problem hiding this comment.
Confirming we can remove this ignore?
This branch has not been deployed
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.
Description
Ports the ranking behavior from merged Azure/azure-cosmos-dotnet-v3#6130 to the Java Cosmos hybrid-search pipeline.
Component scores
10, 5, 5, 5, 0now receive ordinal ranks1, 2, 3, 4, 5by default. SettingAZURE_COSMOS_HYBRID_SEARCH_USE_COMPETITION_RANKING=trueselects competition ranks1, 2, 2, 2, 5instead, not dense ranks. The internal setting is captured once per query.Component-score ties use the unsigned numeric document RID in the query-plan sort direction, independent of normalized weights. Final results sort by fused score descending, then numeric document RID descending. The existing RID helper decodes the little-endian document component once per incoming row; encoded RIDs still define deduplication identity. Weights and
weight / (60 + rank)remain unchanged.The score matrix uses the query-plan component count, preserving the existing undefined-score fallback when the first row—or every row—has empty scores. Payloads and reactive paging are retained. No SDK regeneration or Swagger changes are involved.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines
The 15 focused offline tests pass with the environment opt-in unset and set to
true. Reactor compilation (Java 8 and 21 targets) and configured Checkstyle checks pass; existing Cosmos configuration excludes implementation sources from Checkstyle. Live service tests and SpotBugs were not run. The breaking-change checkbox remains open for review because tie-ranking behavior intentionally changes; no public client API is added.