Note: If your issue/bug is regarding the AWS Amplify Console service, please log it in the
Amplify Console GitHub Issue Tracker
Describe the bug
It is not possible to search in an enum field, the transform does not construct the search query with that field.
Amplify CLI Version
4.12.0
To Reproduce
Make a @model
and @searchable
type, add a enum field type, and build.
Expected behavior
The enum type field were included
Any updates on this?
+1
+1
+1 - enterprise blocker, any workarounds known?
+1
+1
Hi all, we understand this is a pain-point and will prioritize accordingly but we can't commit to a timeline for the fix at this point.
In the meantime, the workaround is to modify the generated search query to include the enum in your schema.
@edwardfoyle We don't want to change generated code files, so we copyied the Searchable FilterInput to our schema.graphql
:
SearchableFooBarFilterInput
from build/schema.graphql
to your schema.graphql
. (Where FooBar is the name of your model.)*FilterInput
dependencies of the above input
as well.myEnum: SearchableStringFilterInput
to the SearchableFooBarFilterInput
in schema.graphql
.amplify push
This unblocks us, but obviously the workaround is not great in the long term, so I appreciate that you're prioritizing a fix in Amplify.
On our end, we worked around this issue from the application layer by creating a proxy string field to replicate the enum field value.
Order @model @searchable {
paymentStatus: OrderPaymentStatusEnum!
paymentState: String! # Proxy for paymentStatus to enable filtering on searchable
I share the same sentiments with @mmiermans on this issue.
This unblocks us, but obviously the workaround is not great in the long term, so I appreciate that you're prioritizing a fix in Amplify.
Thanks!
+1 - facing the same issue and would expect enum types to behave like string input types when it comes to sorting/filtering
+1
I think I will go with the Proxy solution but it's a pain.
+1
+1 please fix it team :-)
+1
+1
+1
Hey @edwardfoyle.
Do you have good news to share with us about this missing feature?
+1
Most helpful comment
+1 - facing the same issue and would expect enum types to behave like string input types when it comes to sorting/filtering