Commit d418ba1
fix: Preserve rrf_ranking_alpha=0.0 in MatchingEngineIndexEndpoint hybrid queries
`HybridQuery.rrf_ranking_alpha` is an optional float that defaults to
`None`. Two call sites in `matching_engine_index_endpoint.py` previously
gated RRF wiring on the truthiness of this field
(`if query.rrf_ranking_alpha`), which incorrectly treated an explicit
`0.0` the same as an unset value. As a result, callers passing
`rrf_ranking_alpha=0.0` (pure sparse ranking) had the `rrf` submessage
silently omitted from the outgoing request, and the server fell back to
its default alpha instead of honoring the caller's intent.
Switch both sites to `is not None` so `0.0` is preserved end-to-end:
- `find_neighbors` (public path, `FindNeighborsRequest.Query.RRF`)
- `match` (private-service-access path, `MatchRequest.RRF`)
Extend `_TEST_HYBRID_QUERIES` with a sparse-only entry that sets
`rrf_ranking_alpha=0.0`, and update the two consumers
(`test_private_service_access_hybrid_search_match_queries` and
`test_index_public_endpoint_find_neighbors_queries`) to assert that the
resulting RPC contains `rrf { alpha: 0.0 }` (instead of no rrf at all).
Also switch the expected-side predicate in the private-service-access
test from truthiness to `is not None` for consistency with the SDK.
FUTURE_COPYBARA_INTEGRATE_REVIEW=#6967 from googleapis:release-please--branches--main 4a0d1d2
PiperOrigin-RevId: 9485400181 parent 3335750 commit d418ba1
2 files changed
Lines changed: 29 additions & 3 deletions
File tree
- google/cloud/aiplatform/matching_engine
- tests/unit/aiplatform
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1865 | 1865 | | |
1866 | 1866 | | |
1867 | 1867 | | |
1868 | | - | |
| 1868 | + | |
1869 | 1869 | | |
1870 | 1870 | | |
1871 | 1871 | | |
| |||
2200 | 2200 | | |
2201 | 2201 | | |
2202 | 2202 | | |
2203 | | - | |
| 2203 | + | |
2204 | 2204 | | |
2205 | 2205 | | |
2206 | 2206 | | |
| |||
Lines changed: 27 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
261 | 266 | | |
262 | 267 | | |
263 | 268 | | |
| |||
1539 | 1544 | | |
1540 | 1545 | | |
1541 | 1546 | | |
1542 | | - | |
| 1547 | + | |
1543 | 1548 | | |
1544 | 1549 | | |
1545 | 1550 | | |
| |||
2093 | 2098 | | |
2094 | 2099 | | |
2095 | 2100 | | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
2096 | 2122 | | |
2097 | 2123 | | |
2098 | 2124 | | |
| |||
0 commit comments