feat(search): sort results via sortProperties / order_by - #3298
Draft
dschmidt wants to merge 7 commits into
Draft
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 116 |
🟢 Coverage 50.85% diff coverage · +0.13% coverage variation
Metric Results Coverage variation ✅ +0.13% coverage variation (-1.00%) Diff coverage ✅ 50.85% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (dfe5fdb) 89958 21487 23.89% Head commit (ac2f094) 90212 (+254) 21669 (+182) 24.02% (+0.13%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#3298) 295 150 50.85% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
dschmidt
force-pushed
the
feat/search-sort-properties
branch
from
August 12, 2026 23:08
e443b80 to
cc497cc
Compare
dschmidt
force-pushed
the
feat/search-sort-properties
branch
from
August 18, 2026 17:11
cc497cc to
97626bb
Compare
…der_by) (cherry picked from commit 1b748fb)
Validated against the sortable-field whitelist (name, size, lastModifiedDateTime, photo.takenDateTime) and forwarded to the search service as order_by. Also fixes the stub search service's IndexSpace signature (streaming response) so the suite builds again. (cherry picked from commit 9aa6a34) (cherry picked from commit 35a6cad8ea6a7890bdc0bc98c7ac97bdcbf477cc)
Sortable is every field that is indexed as a scalar and carried on the match entity: name, size, lastModifiedDateTime, mimeType and the scalar facet fields (photo.*, audio.*, image.*, location.*, ...). Both sets are derived by reflection, so new facet fields become sortable automatically. Multivalued fields (tags), bare facets and internal index fields are rejected with invalidRequest at the graph layer. CompareMatches provides the merge comparator for the service layer. (cherry picked from commit bd32795)
The fan-out passes order_by through to each engine query; the merge re-sorts the combined matches with CompareMatches and keeps the score as tiebreaker (and as the sole criterion when no order_by is given). (cherry picked from commit 66af40f)
(cherry picked from commit 66a0755)
Name is analyzed (lowercaseKeyword) and therefore a text field, which OpenSearch refuses to sort on without fielddata; enable it in the index template. The keyword tokenizer emits one term per document, so the fielddata cache stays small. The schema version has not shipped yet, so no reindex is needed. (cherry picked from commit f1d0e7b)
The grpc layer rebuilt the searcher request field by field and dropped order_by; the response cache also ignored it, so differently sorted searches collided on the same cache entry. (cherry picked from commit 97626bb)
dschmidt
force-pushed
the
feat/search-sort-properties
branch
from
September 7, 2026 22:35
97626bb to
ac2f094
Compare
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.
Adds MS-Graph-style
sortPropertiesto the graph search endpoint andorder_byto the search proto.invalidRequest.name).order_byis wired through the grpc service and its response cache key.Spec: opencloud-eu/libre-graph-api#61
Stacked on #3211.