Skip to content
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

Closed
wants to merge 10 commits into from

Conversation

monotasker
Copy link
Contributor

❤️ 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:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.

Copy link
Collaborator

@fenekku fenekku left a 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.

docs/reference/rest_api_awards.md Outdated Show resolved Hide resolved
docs/reference/rest_api_communities.md Outdated Show resolved Hide resolved
docs/reference/rest_api_communities.md Outdated Show resolved Hide resolved
Comment on lines 36 to 48
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-->
Copy link
Collaborator

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 👍 .

Copy link
Contributor Author

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.

monotasker and others added 3 commits March 27, 2024 12:11
Co-authored-by: Guillaume Viger <fenekku@fenekku.com>
Co-authored-by: Guillaume Viger <fenekku@fenekku.com>
Co-authored-by: Guillaume Viger <fenekku@fenekku.com>
Copy link
Collaborator

@fenekku fenekku left a 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.
Copy link
Collaborator

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:

Suggested change
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 🤞 .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right. Thanks

@monotasker
Copy link
Contributor Author

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.

@fenekku
Copy link
Collaborator

fenekku commented Apr 8, 2024

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?

@monotasker
Copy link
Contributor Author

monotasker commented Apr 8, 2024

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: /assets/stylesheets/main.10ba22f1.min.css and /assets/stylesheets/palette.06af60db.min.css. These are linked in the frontpage_base.html template, and the files do indeed seem to be missing. I don't think this is related to any of my changes. Maybe something happened upstream that is just becoming visible here? (Or maybe I'm missing something!)

@fenekku
Copy link
Collaborator

fenekku commented Apr 8, 2024

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 😉 .

@monotasker
Copy link
Contributor Author

Sure. No problem

@fenekku
Copy link
Collaborator

fenekku commented Apr 10, 2024

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!

@fenekku fenekku closed this Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants