-
Notifications
You must be signed in to change notification settings - Fork 67
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
Added available sort options for all REST API endpoints that allow sorting #612
Conversation
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.
Thanks for these, really appreciate you documenting that special sorting logic we have. Just some minor things, but worth aligning on subjects + no need for general sort section (I think) before merging.
The sort options available vary depending on the vocabulary being searched. These cannot presently be configured via config variables but are set in the service configuration for each vocabulary service. The default sort options are used where a vocabulary service has not defined its own: | ||
|
||
| Vocabulary | Available sort options | Default | Default without a query string | | ||
| ---------- | ---------------------- | ------- | ------------------------------ | | ||
| default | `"bestmatch"`, `"title"`, `"newest"`, `"oldest"` | `"bestmatch"` | `"title"` | | ||
| affiliations | `"bestmatch"`, `"name"`, `"newest"`, `"oldest"` | `"bestmatch"` | `"name"` | | ||
| awards | `"bestmatch"`, `"title"`, `"newest"`, `"oldest"` | `"bestmatch"` | `"title"` | | ||
| funders | `"bestmatch"`, `"name"`, `"newest"`, `"oldest"` | `"bestmatch"` | `"name"` | | ||
| names | `"bestmatch"`, `"name"`, `"newest"`, `"oldest"` | `"bestmatch"` | `"name"` | | ||
| subjects* | `"bestmatch"`, `"subject"`, `"newest"`, `"oldest"` | `"bestmatch"` | `"subject"` | | ||
|
||
(\* Subjects are available only at the `/api/subjects` endpoint, but are included here for reference since they are provided by a vocabulary service.) | ||
<!--Maybe the subjects sort options should be moved to documentation for the `api/subjects` endpoint--> |
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.
I think this repeats information given in the specific vocabularies REST API documentation so I wouldn't include it.
We are indeed missing a rest_api_subjects.md
documentation page. I've created a ticket for this: #613 and we can deal with it separately there 👍 .
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.
Makes sense. I'll make sure the order is flipped on all the endpoints. Then I'll remove the table and just document the default sort options. I think it's still useful to have the defaults documented, since not all vocabularies have their own endpoint.
Co-authored-by: Guillaume Viger <fenekku@fenekku.com>
Co-authored-by: Guillaume Viger <fenekku@fenekku.com>
Co-authored-by: Guillaume Viger <fenekku@fenekku.com>
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.
Just the failing tests to fix and we are good to merge 😄
| `size` | integer | query | Specify number of items in the results page (default: 10). | | ||
| `page` | integer | query | Specify the page of results. | | ||
| `type` | string | query | Specify community type as one of organization, event, topic or project. | | ||
| `accept` | string | header | - `application/json` (default)<br />- `application/vnd.inveniordm.v1+json` | | ||
|
||
Sort options for communities can be configured using the `COMMUNITIES_SORT_OPTIONS` config variable as described in the [search customization](../customize/search) section. Note that `"bestmatch"` is only available as a sort option on requests that provide a query string as a `q` parameter. Otherwise `"bestmatch"` is ignored and the default `"newest"` sort is used. |
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.
The failing tests are because the links have to be to the markdown files. Mkdocs then takes care of converting them to regular files. So we have to replace:
Sort options for communities can be configured using the `COMMUNITIES_SORT_OPTIONS` config variable as described in the [search customization](../customize/search) section. Note that `"bestmatch"` is only available as a sort option on requests that provide a query string as a `q` parameter. Otherwise `"bestmatch"` is ignored and the default `"newest"` sort is used. | |
Sort options for communities can be configured using the `COMMUNITIES_SORT_OPTIONS` config variable as described in the [search customization](../customize/search.md) section. Note that `"bestmatch"` is only available as a sort option on requests that provide a query string as a `q` parameter. Otherwise `"bestmatch"` is ignored and the default `"newest"` sort is used. |
and then we should be fine 🤞 .
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.
Ah, right. Thanks
Okay, I've made the minor changes to default option ordering, removed the table of vocab options (leaving a description of the defaults), and fixed the missing file extensions in the links. Should be good to go. |
Hmm something is off with the links (see https://github.com/inveniosoftware/docs-invenio-rdm/actions/runs/8582061590/job/23563183805?pr=612), but at least one other PR is potentially affected: https://github.com/inveniosoftware/docs-invenio-rdm/actions/runs/8526851030/job/23356983728?pr=614 ... I will add this as something I will look into this month as part of preparations for v12 since we need to make sure docs are good. Can you rebase it to see if that fixes it? |
Co-authored-by: Guillaume Viger <fenekku@fenekku.com>
Okay, I rebased my branch but it doesn't seem to have fixed the issue. When I build the docs locally I get the same error: not from links in the documentation text but because of two missing style files: |
Indeed something is strange. If you don't mind, when I look into it, may I push to your branch to fix it? This will be faster and you've already done the heavy lifting, so you shouldn't have to deal with that structural problem 😉 . |
Sure. No problem |
Merged it here: #619 (@monotasker 's master branch is probably protected so I couldn't push to it). I think Nico fixed the issue by resetting the clean options: c6e7334#diff-1db27d93186e46d3b441ece35801b244db8ee144ff1405ca27a163bfe878957fR41 . Kind of strange nevertheless. Thank you! |
❤️ Thank you for your contribution!
Description
Added documentation on the sort options available for all REST API endpoints that allow sorting.
Checklist
Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:
Third-party code
If you've added third-party code (copy/pasted or new dependencies), please reach out to an architect.
Reminder
By using GitHub, you have already agreed to the GitHub’s Terms of Service including that: