Skip to content

Using Search query on a float field returning unexpected results. #866

@jeff-accountably

Description

@jeff-accountably

Description

Here is my example query code running in javascript on the client side.

return useGraphQLQuery(
    {
      filter: {
        transactionTotalAmount: { eq: 29 },
      },
      sort: {
        direction: "desc",
        field: "transactionDate",
      },
      limit: 10,
    },
    searchTransactions,
    "searchTransactions"
  );

My schema has the field as a float, and the model object is tagged with @searchable.

In my database I have a number of transactions that are 29.98, or 29.37, etc. They all get returned from this query, which is unexpected, since only 29 should be returned.

If I change the filter to be transactionTotalAmount: { eq: 29.98 } nothing gets returned, even though that should be an exact match with the transaction that is 29.98.

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Storage

Steps to Reproduce

No response

Screenshots

No response

Platforms

  • iOS
  • Android

Android Device/Emulator API Level

No response

Environment

ReactJS

Dependencies

N/A

Device

N/A

OS

N/A

CLI Version

8.0.3

Additional Context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions