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

Commit 28507cb

Browse files
authored
Specify missing edge cases (#63)
1 parent db6ed4c commit 28507cb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

text/0055-sort.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
- Start Date: 2021-07-20
33
- Specification PR: [#55](https://github.com/meilisearch/specifications/pull/55)
44
- Discovery Issue: [#43](https://github.com/meilisearch/product/issues/43)
5-
- MeiliSearch Tracking-issues:
65

76
# Sort
87

@@ -149,6 +148,10 @@ Request body
149148

150149
- Introduce a `sort` parameter on GET/POST `/search` methods.
151150

151+
> 💡 In the case where an attribute is specified as a sort criterion at search time and if this attribute is of a different type between several documents, the numeric type will always be favored first by the engine. This means that documents with numeric values for this attribute will be sorted before those with string values. This can lead to awkward sorting behavior, so the user should make sure to have the same type on the attribute he wants to sort on for all these documents.
152+
153+
> 💡 In the case where an attribute is specified as a sort criterion at search time and does not exist on a document, the document will be placed at the end of the ranking rule sort.
154+
152155
**GET Search /indexes/{indexUid}/search**
153156

154157
`sort` - String - E.g. `sort="price:asc,released_date:desc"`
@@ -408,6 +411,8 @@ Note that if I change the `sort` parameter's value order, it changes the inner e
408411
- Add `sort` query/request parameter on `/search` resource. Support `string` and `number`. `string` can be sorted in lexicographical order.
409412
- Change custom ranking rule format. e.g. `asc(price)` become `price:asc`
410413
- Add a new error `invalid_sort` similar to `invalid_filter`.
414+
- The numeric type is preferred to the string type by the `sort` ranking rule. If an attribute has different types among the documents, those containing a numeric value will be placed before the documents containing a string value type.
415+
- A document not containing an attribute requested in the `sort` parameter will be placed last during the tie-breaking of the `sort` ranking-rule.
411416

412417
## 2. Technical details
413418

0 commit comments

Comments
 (0)