Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Errors - Add variant for invalid_filter/invalid_sort when related settings are empty #125

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions text/0061-error-format-and-definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,19 @@ HTTP Code: `400 Bad Request`
- The `:attribute` is inferred when the message is generated.
- The `:filterableAttributes` is inferred when the message is generated. It contains the list of filterable attributes separated by a comma. `filterableAttribute1, filterableAttribute2, ...`

#### Variant: Filtering on a non filterable attribute when `filterableAttributes` is empty

```json
{
"message": "Attribute `:attribute` is not filterable. This index does not have configured filterable attributes.",
"code": "invalid_filter",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_filter"
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure why, but this works: https://docs.meilisearch.com/reference/api/error_codes.html#invalid-filter not https://docs.meilisearch.com/reference/api/error_codes.html#invalid_filter.

Any thoughts @guimachiavelli @bidoubiwa ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good spot @brunoocasali! May need to update the whole specification then 🥷 At least the link leads to the errors page.

Copy link
Contributor

Choose a reason for hiding this comment

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

The errors page story is an old one built on an ancient and questionable script. See meilisearch/documentation#1299
But good new, it is being updated by @maryamsulemani97 meilisearch/documentation#1503

Once that PR is merged there shouldn't be any anchor problems and we'll be able to search for error codes in the search bar of the documentation

Copy link
Member Author

Choose a reason for hiding this comment

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

As long as the anchors work and the routes returned by the binary do not fall on a 404, it is all good on our side.

Please, let us know if we need to make a change on our end. On the other side, it could be managed with redirections on the documentation site 😇

Copy link
Member

@guimachiavelli guimachiavelli Mar 15, 2022

Choose a reason for hiding this comment

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

The Errors page was until recently completely separate from the regular docs website. While all our docs are written in markdown, that specific page was generated from a yaml file as described by @bidoubiwa. We scrapped that a few weeks ago and moved the Errors page completely inside vuepress. The transition was a glorified copypaste of yaml content into an md file; it also moved docs.meilisearch.com/errors into docs.meilisearch.com/api/error_codes.html. meilisearch/documentation#1503 will further improve the page (and possibly move it again).

The anchor link formatting is related to this transition. Vuepress automatically turns spaces into -, not _. docs.meilisearch.com/errors#invalid_filter only worked because the Errors page was outside vuepress. Now that the Errors page is being parsed as markdown, all anchor links will use -.

We are already redirecting regular links (https://docs.meilisearch.com/errors) to the new page (https://docs.meilisearch.com/reference/api/errors), but I'm unsure our redirects allow us to do the same for anchor links. Even if it is possible, it would probably require a lot of effort for relatively little gain (as @gmourier says, users are still brought to the correct page).

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, @guimachiavelli for the information! It should be easy to change the links on the core side if it's not possible to have a redirection on the documentation side that would lead to the right anchor.

The advantage of redirection is that we are all more independent.

It's not a big problem, just let me know if the redirection is possible when we have time to explore this topic. Then we'll see. 🚀

}
```

- The `:attribute` is inferred when the message is generated.
gmourier marked this conversation as resolved.
Show resolved Hide resolved

#### Variant: Using `_geoDistance` as a filter expression

```json
Expand Down Expand Up @@ -529,6 +542,19 @@ HTTP Code: `400 Bad Request`
- The `:attribute` is inferred when the message is generated.
- The `:sortableAttributes` is inferred when the message is generated. It contains the list of sortable attributes separated by a comma. `sortableAttribute1, sortableAttribute2, ...`

#### Variant: Sorting on a non sortable attribute when `sortableAttributes` is empty

```json
{
"message": "Attribute `:attribute` is not sortable. This index does not have configured sortable attributes.",
"code": "invalid_sort",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_sort"
gmourier marked this conversation as resolved.
Show resolved Hide resolved
}
```

- The `:attribute` is inferred when the message is generated.

#### Variant: Using `_geoDistance` as a sort expression

```json
Expand Down