-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add sorting feature in library mode #943
Conversation
Test Results 4 files ± 0 4 suites ±0 4m 42s ⏱️ ±0s Results for commit 633fc79. ± Comparison against base commit 2ed579c. This pull request removes 9 and adds 14 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
Code Coverage (Ubuntu)
Minimum allowed coverage is Generated by 🐒 cobertura-action against 8040800 |
Code Coverage (Windows)
Minimum allowed coverage is Generated by 🐒 cobertura-action against 8040800 |
2a7284f
to
c5b5285
Compare
c5b5285
to
64126c5
Compare
db824e3
to
a3022ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- please use
mypy
to fix inserted code - if possible, add
sort_by_params
toplugin.query_params
andplugin .query_string
instead of storing it inplugin.sort_by_params
- remove unneeded url templates from provider configuration
a3022ac
to
8040800
Compare
…able in get_sort_by function
8040800
to
2dfa11f
Compare
Code Coverage (Ubuntu)
Diff against develop
Results for commit: 633fc79 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Code Coverage (Windows)
Diff against develop
Results for commit: 633fc79 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
fixes #888
The set up of the sort feature is done:
sortBy
sorting search argument transformation to specific-provider sort search query string or dictionnary is implemented ineodag/plugins/search/base.py
and it is used in theQueryStringSearch
andPostJsonSearch
search plugins which are the parents of GET and POST other search plugins (exceptDataRequestSearch
which does not accept the sort feature). For providers using an api plugin, as sort withUSGS
does not work, then an error is raised with the use ofsortBy
argument. For the other ones, their plugin is child ofBuildPostSearchResult
search plugin, then it works as a search plugin.all providers which support the sort feature are configured for it. When a provider does not support it, an error is raised.
sortBy
argument is a list of tuples of a sorting parameter (startTimeFromAscendingNode
,storageStatus
,id
, etc.) and a sorting order (ASC
|DESC
). An example is given below.if a sorting parameter is used with a provider which does not support it, an error is raised.
if more than the maximum number of sortable parameters allowed by the provider is used, an error is raised.
if not precised, a search will sort results by default sorting parameters of the provider used (except for
planetary_computer
to preventTimeOutError
).the sort feature can only be used in library mode for now, the server and CLI modes will be implemented on other PRs later.
Here is an same example of a
S2_MSI_L1C
product type sorted by start date in ascending order:Furthermore, the method
available_sortables()
that lists sorting parameter(s) and its (their) maximum number allowed with all providers is also implemented.Notes:
hydroweb_next
provider does not work properly (the provider will fix this feature soon).