amplify-cli: Unable to search on enum field with @searchable
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
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 24
- Comments: 34 (3 by maintainers)
+1 - facing the same issue and would expect enum types to behave like string input types when it comes to sorting/filtering
@edwardfoyle We don’t want to change generated code files, so we copyied the Searchable FilterInput to our
schema.graphql:SearchableFooBarFilterInputfrombuild/schema.graphqlto yourschema.graphql. (Where FooBar is the name of your model.)*FilterInputdependencies of the aboveinputas well.myEnum: SearchableStringFilterInputto theSearchableFooBarFilterInputinschema.graphql.amplify pushThis unblocks us, but obviously the workaround is not great in the long term, so I appreciate that you’re prioritizing a fix in Amplify.
Hi folks this is now supported! https://docs.amplify.aws/cli/graphql/search-and-result-aggregations/#supported-search-operations
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.
Hi folks - we’re planning on addressing this as part of our new GraphQL transformer. The approach is captured here in our RFC: https://github.com/aws-amplify/amplify-cli/issues/7546 love to hear your feedback!
Why this still not be fixed?!!
+1, happy birthday 🎂
@andy-HM I think that you need to migrate to the new transformer version (v2) first: https://docs.amplify.aws/cli/migration/transformer-migration/
Hello, thank you for adding support for this! Can you explain hot to make use of this on types that are already marked as @searchable? I have an existing table that is affected by the original lack of support for searching enums. After reading this, I have redeployed my models in the Amplify Studio as well as pushed my schema from my project. Either way, I do not see the additional enum fields available for searching within the filter input of that type.