You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ranks `$search` results by fuzzy relevance on HANA, and correctly
correlates the ranking `ORDER BY` to the outer row. Standalone against
`main` (supersedes the stacked PR #1717 / includes #1564's search-order
groundwork).
### What
- **Rank by relevance**: inject `ORDER BY <score> DESC` for `$search`.
Deep (path) search ranks each outer row by its best-matching child via a
correlated `(SELECT MAX(SCORE(...)) ... WHERE innerKey = outerKey)`
sub-select — resolving the earlier `key IN (key)` tautology (correlation
applied post-`infer()`, mirroring expand's `_correlate`).
- **Gated to scoring backends**: only when `cds.db.kind === 'hana'` and
fuzzy is on — sqlite/postgres (no score) get no ranking.
- **Opt-out**: `cds.env.hana.fuzzy.ranked_search = false`; `fuzzy` also
accepts `{ score, ranked_search }`.
- **Order-by precedence**: user ordering → search rank → runtime
implicit key ordering (`implicit: true`).
### Tests
- cqn4sql: rank shape, precedence, opt-out, non-HANA gating.
- HANA e2e (live-verified): deep to-many ranking + dedup; user order-by
precedence; opt-out contrast; OData `$search` via the bookshop service
showing rank beats implicit key ordering; `fuzzy` object config.
---------
Co-authored-by: Bob den Os <bob.den.os@sap.com>
Co-authored-by: D045778 <johannes.vogel@sap.com>
0 commit comments