Conversation
BobdenOs
requested review from
danjoa,
johannes-vogel,
patricebender,
sjvans and
stewsk
as code owners
April 9, 2026 09:45
patricebender
force-pushed
the
feat/hana-search-orderby
branch
from
August 27, 2026 15:58
4b10532 to
9425c1d
Compare
patricebender
force-pushed
the
feat/hana-search-orderby
branch
from
September 4, 2026 09:56
9425c1d to
0c4fe6e
Compare
This was referenced Sep 4, 2026
Contributor
|
consumed in #1725 |
sjvans
pushed a commit
that referenced
this pull request
Sep 7, 2026
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>
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.
No description provided.