-
Notifications
You must be signed in to change notification settings - Fork 79
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
GraphQL @searchable sorting on Float incorrect order #1276
Comments
Hi @txmazing , can you share your schema and also check in your OpenSearch instance what the type for that |
type Item
@model
@auth(
rules: [
{ allow: private, operations: [read] }
{ allow: public, operations: [read], provider: iam }
{
allow: groups
groups: ["admin"]
operations: [read, create, update, delete]
}
]
)
@searchable
{
id: ID!
name: String!
picture: AWSURL!
strength: Int!
urlname: String!
rating: Float
}
|
Thank you, @txmazing. This sounds very similar to the issue detailed here: It might be the case that the first record created had a rating without a decimal point like Can you try this and see if it helps? |
This seems to work. Thank you :) |
Awesome! Thank you for confirming 😃 I'll close this issue as resolved then. |
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication, Analytics, GraphQL API
Amplify Categories
auth, function, api, analytics, hosting
Environment information
Describe the bug
We use @serchable for our data. We have a float "rating" according to which should be sorted in descending order.
Instead of sorting "ratings" like 3, 3.5 and 3 in descending order (as 3.5, 3, 3) only the digit before the comma is taken into account and then sorted alphabetically (i.e. 3. 3.5, 3 or even 3, 3, 3.5). In this case all "3.X" entries are simply queried after "4.X" and before "2.X" entries and then ordered alphabetically.
Expected behavior
The digits after the decimal point should also be taken into account, so that if 3.5 is queried 2 times, sorting by name only takes place afterwards.
Reproduction steps
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: