Skip to content

Commit

Permalink
Added available sort options for all REST API queries that allow sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
monotasker committed Mar 26, 2024
1 parent 4df97a4 commit 0958f65
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 7 deletions.
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"`). |
| `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 @@ Content-Type: application/json
| 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"`). |
| `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

**Request**

Expand Down Expand Up @@ -393,12 +394,13 @@ Same as `GET /api/communities` but with the authenticated user's communities in
| 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"`). |
| `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 @@ Content-Type: application/json
| 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 @@ Used for interacting with the records and drafts you can edit.
| 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 @@ The following general restrictions apply to the member API:
| `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 @@ Content-Type: application/json
| `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 @@ Content-Type: application/json
| `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

0 comments on commit 0958f65

Please sign in to comment.