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
5 changes: 5 additions & 0 deletions docs/reference/rest_api_awards.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ Query and retrieve entries from the [**awards** vocabulary](../customize/vocabul
| Name | Type | Location | Description |
| -------- | ------ | -------- | ------------------------------------ |
| `q` | string | query | Search query used to filter results. |
| `sort` | string | query | Sort search results. Built-in options are `"bestmatch"`, `"title"`, `"newest"`, `"oldest"` (default: `"bestmatch"` or `"title"`). |
monotasker marked this conversation as resolved.
Show resolved Hide resolved
| `size` | integer | query | Specify number of items in the results page (default: 10). |
| `page` | integer | query | Specify the page of results. |
| `suggest` | string | query | "Search as you type" query. |
| `accept` | string | header | - `application/json` |

Sort options for awards are configured on the vocabulary service class. 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 `"title"` sort is used.

**Query string syntax**

The query string syntax is based on [ElasticSearch's query string syntax](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax), and can include the following search fields:
Expand Down
6 changes: 4 additions & 2 deletions docs/reference/rest_api_communities.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,13 @@
| Name | Type | Location | Description |
|----------|---------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `q` | string | query | Search query used to filter results based on [ElasticSearch's query string syntax](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax). |
| `sort` | string | query | Sort search results (default: newest). |
| `sort` | string | query | Sort search results. Built-in options are `"bestmatch"`, `"newest"`, `"oldest"`, `"updated-desc"`, `"updated-asc"`, `"version"` (default: `"newest"` or `"bestmatch"`). |
monotasker marked this conversation as resolved.
Show resolved Hide resolved
| `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.

Check failure on line 302 in docs/reference/rest_api_communities.md

View workflow job for this annotation

GitHub Actions / Tests

bad links: reference/customize/search
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


**Request**

Expand Down Expand Up @@ -393,12 +394,13 @@
| Name | Type | Location | Description |
|----------|---------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `q` | string | query | Search query used to filter results based on [ElasticSearch's query string syntax](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax). |
| `sort` | string | query | Sort search results (default: newest). |
| `sort` | string | query | Sort search results. Built-in options are `"bestmatch"`, `"newest"`, `"oldest"`, `"updated-desc"`, `"updated-asc"`, `"version"` (default: `"newest"` or `"bestmatch"`). |
monotasker marked this conversation as resolved.
Show resolved Hide resolved
| `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.

Check failure on line 403 in docs/reference/rest_api_communities.md

View workflow job for this annotation

GitHub Actions / Tests

bad links: reference/customize/search

**Request**

Expand Down
8 changes: 6 additions & 2 deletions docs/reference/rest_api_drafts_records.md
Original file line number Diff line number Diff line change
Expand Up @@ -1105,12 +1105,14 @@
| Name | Type | Location | Description |
| -------------- | ------- | -------- | ------------------------------------------------------------ |
| `q` | string | query | Search query used to filter results based on [ElasticSearch's query string syntax](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax). |
| `sort` | string | query | Sort search results. |
| `sort` | string | query | Sort search results. Built-in options are `"bestmatch"`, `"newest"`, `"oldest"`, `"updated-desc"`, `"updated-asc"`, `"version"`, `"mostviewed"`, `"mostdownloaded"` (default: `"newest"` or `"bestmatch"`). |
| `size` | integer | query | Specify number of items in the results page (default: 10). |
| `page` | integer | query | Specify the page of results. |
| `allversions` &nbsp; | boolean | query | Specify if all versions should be included (default: `False`, displays just latest version). |
| `accept` | string | header | - `application/json` (default)<br />- `application/vnd.inveniordm.v1+json` |

Check failure on line 1112 in docs/reference/rest_api_drafts_records.md

View workflow job for this annotation

GitHub Actions / Tests

bad links: reference/customize/search

Sort options for communities can be configured using the `RDM_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. Queries sorted by `"mostviewed"` and `"mostdownloaded"` are in descending order.

**Request**

```http
Expand Down Expand Up @@ -1772,12 +1774,14 @@
| Name | Type | Location | Description |
| -------- | ------- | -------- | ------------------------------------------------------------ |
| `q` | string | query | Search query used to filter results based on [ElasticSearch's query string syntax](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax). |
| `sort` | string | query | Sort search results. |
| `sort` | string | query | Sort search results. Built-in options are `"bestmatch"`, `"newest"`, `"oldest"`, `"updated-desc"`, `"updated-asc"`, `"version"`, `"mostviewed"`, `"mostdownloaded"` (default: `"newest"` or `"bestmatch"`). |
| `size` | integer | query | Specify number of items in the results page (default: 10). |
| `page` | integer | query | Specify the page of results. |
| `allversions` &nbsp; | boolean | query | Specify if all versions should be included. |

Check failure on line 1780 in docs/reference/rest_api_drafts_records.md

View workflow job for this annotation

GitHub Actions / Tests

bad links: reference/customize/search
| `accept` | string | header | - `application/json` (default)<br />- `application/vnd.inveniordm.v1+json` |

Sort options for communities can be configured using the `RDM_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. Queries sorted by `"mostviewed"` and `"mostdownloaded"` are in descending order.

**Request**

```http
Expand Down
5 changes: 5 additions & 0 deletions docs/reference/rest_api_funders.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ Query and retrieve entries from the [**funders** vocabulary](../customize/vocabu
| -------- | ------ | -------- | ------------------------------------ |
| `q` | string | query | Search query used to filter results. |
| `suggest` | string | query | "Search as you type" query. |
| `sort` | string | query | Sort search results. Built-in options are `"bestmatch"`, `"name"`, `"newest"`, `"oldest"` (default: `"bestmatch"` or `"name"`). |
| `size` | integer | query | Specify number of items in the results page (default: 10). |
| `page` | integer | query | Specify the page of results. |
| `accept` | string | header | - `application/json` |

Sort options for funders are configured on the vocabulary service class. 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 `"name"` sort is used.

**Query string syntax**

The query string syntax is based on [ElasticSearch's query string syntax](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax), and can include the following search fields:
Expand Down
10 changes: 8 additions & 2 deletions docs/reference/rest_api_members.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@
| `id` | string | path | Community UUID identifier |
| `accept` | string | header | - `application/json` |
| `q` | string | query | Search query used to filter results. |
| `sort` | string | query | Sort search results. |
| `sort` | string | query | Sort search results. Built-in options are `"bestmatch"`, `"name"`, `"newest"`, `"oldest"` (default: `"name"` or `"bestmatch"`). |
| `size` | integer | query | Specify number of items in the results page (default: 10). |
| `page` | integer | query | Specify the page of results. |
| `role` | string | query | Filter by role (one of ``reader``, ``curator``, ``manager``, ``owner``). |
| `visibility` | boolean | query | Filter by visibility (one of ``true``, ``false``) |

Sort options for community members can be configured using the `COMMUNITIES_MEMBERS_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, in which case it is the default sort type. If no query string is provided in the request, the default sort type is `"name"`. In this case a `"bestmatch"` value is ignored and the default `"name"` sort is used.

Check failure on line 40 in docs/reference/rest_api_members.md

View workflow job for this annotation

GitHub Actions / Tests

bad links: reference/customize/search

**Request**

```http
Expand Down Expand Up @@ -157,6 +159,8 @@
| `size` | integer | query | Specify number of items in the results page (default: 10). |
| `page` | integer | query | Specify the page of results. |

Note that no sort options are available when searching public members. The results are sorted by `"name"` in ascending order.

**Request**

```http
Expand Down Expand Up @@ -205,13 +209,15 @@
| `id` | string | path | Community UUID identifier |
| `accept` | string | header | - `application/json` |
| `q` | string | query | Search query used to filter results. |
| `sort` | string | query | Sort search results. |
| `sort` | string | query | Sort search results. Built-in options are `"bestmatch"`, `"name"`, `"newest"`, `"oldest"` (default: `"name"` or `"bestmatch"`). |
| `size` | integer | query | Specify number of items in the results page (default: 10). |
| `page` | integer | query | Specify the page of results. |
| `role` | string | query | Filter by role (one of ``reader``, ``curator``, ``manager``, ``owner``). |
| `status` | string | query | Filter by status (one of ``submitted``, ``accepted``, ``declined``, ``expired``, ``cancelled``) |
| `is_open` | boolean | query | Filter by open/closed (one of ``true``, ``false``) |

Sort options for community members can be configured using the `COMMUNITIES_INVITATIONS_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, in which case it is the default sort type. If no query string is provided in the request, the default sort type is `"name"`. In this case a `"bestmatch"` value is ignored and the default `"name"` sort is used.

Check failure on line 219 in docs/reference/rest_api_members.md

View workflow job for this annotation

GitHub Actions / Tests

bad links: reference/customize/search

**Request**

```http
Expand Down
5 changes: 5 additions & 0 deletions docs/reference/rest_api_names.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ Query and retrieve entries from the [**names** vocabulary](../customize/vocabula
| Name | Type | Location | Description |
| -------- | ------ | -------- | ------------------------------------ |
| `q` | string | query | Search query used to filter results. |
| `sort` | string | query | Sort search results. Built-in options are `"bestmatch"`, `"name"`, `"newest"`, `"oldest"` (default: `"bestmatch"` or `"name"`). |
| `size` | integer | query | Specify number of items in the results page (default: 10). |
| `page` | integer | query | Specify the page of results. |
| `suggest` | string | query | "Search as you type" query. |
| `accept` | string | header | - `application/json` |

Sort options for names are configured on the vocabulary service class. 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 `"name"` sort is used.

**Query string syntax**

The query string syntax is based on [ElasticSearch's query string syntax](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax), and can include the following search fields:
Expand Down
5 changes: 4 additions & 1 deletion docs/reference/rest_api_requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,13 @@ Used for listing all requests you can interact with.
| Name | Type | Location | Description |
| -------------- | ------- | -------- | ------------------------------------------------------------ |
| `q` | string | query | Search query used to filter results based on [ElasticSearch's query string syntax](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax). |
| `sort` | string | query | Sort search results. |
| `sort` | string | query | Sort search results. Built-in options are `"bestmatch"`, `"name"`, `"newest"`, `"oldest"` (default: `"newest"` or `"bestmatch"`). |
| `size` | integer | query | Specify number of items in the results page (default: 10). |
| `page` | integer | query | Specify the page of results. |
| `accept` | string | header | - `application/json` (default)<br />- `application/vnd.inveniordm.v1+json` |

Note that `"bestmatch"` is only available as a sort option on requests that provide a query string as a `q` parameter, in which case it is the default sort type. If no query string is provided in the request, the default sort type is `"newest"`. In this case a `"bestmatch"` value is ignored and the default `"newest"` sort is used.

**Request**

```http
Expand Down Expand Up @@ -188,6 +190,7 @@ Content-Type: application/json
],
"total": 2
},
"sortBy": "newest",
"links": {
"self": "{scheme+hostname}/api/requests?page=1&size=25&sort=newest"
}
Expand Down
Loading
Loading