amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

Unable to search on enum field with @searchable

Open jorge-riberi opened this issue 6 years ago • 34 comments

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

jorge-riberi avatar Jan 23 '20 17:01 jorge-riberi

Any updates on this?

VicFrolov avatar Mar 10 '20 04:03 VicFrolov

+1

idanlo avatar Mar 25 '20 17:03 idanlo

+1

cheunjm avatar May 02 '20 00:05 cheunjm

+1 - enterprise blocker, any workarounds known?

jakemitchellxyz avatar May 05 '20 22:05 jakemitchellxyz

+1

yushoo avatar May 05 '20 22:05 yushoo

+1

andrewandyle avatar May 05 '20 22:05 andrewandyle

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 avatar May 12 '20 21:05 edwardfoyle

@edwardfoyle We don't want to change generated code files, so we copyied the Searchable FilterInput to our schema.graphql:

  1. Copy the generated input called SearchableFooBarFilterInput from build/schema.graphql to your schema.graphql. (Where FooBar is the name of your model.)
  2. Copy all *FilterInput dependencies of the above input as well.
  3. Add myEnum: SearchableStringFilterInput to the SearchableFooBarFilterInput in schema.graphql.
  4. 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.

mmiermans avatar May 19 '20 00:05 mmiermans

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!

clodal avatar May 19 '20 01:05 clodal

+1 - facing the same issue and would expect enum types to behave like string input types when it comes to sorting/filtering

casendler avatar Jun 25 '20 22:06 casendler

  • 1

JtawRobot avatar Jul 15 '20 02:07 JtawRobot

+1 I think I will go with the Proxy solution but it's a pain.

eripoll avatar Jul 26 '20 18:07 eripoll

+1

mikerudge avatar Sep 07 '20 14:09 mikerudge

+1 please fix it team :-)

edeuxk avatar Sep 09 '20 05:09 edeuxk

+1

asmiki avatar Sep 09 '20 09:09 asmiki

+1

deepaksingh007 avatar Sep 23 '20 11:09 deepaksingh007

+1

alexboulay avatar Dec 03 '20 21:12 alexboulay

Hey @edwardfoyle. Do you have good news to share with us about this missing feature?

yonatanganot avatar Dec 18 '20 05:12 yonatanganot

+1

PaulCailly avatar Dec 21 '20 09:12 PaulCailly

Getting the same issue,

type Note
  @model
  @searchable
{
  id: ID!
  userID: ID!
  textContent: String
  htmlContent: String
  imageFilename: String
  noteType: NoteTypeEnum!
  createdAt: AWSDateTime
  updatedAt: AWSDateTime
}
enum NoteTypeEnum {
  text
  annotation
}

@idanlo Thank you for your quick solution, But Adding manual searchField into the schema from the Amplify console is a temporary solution. It should be generated automatically. @amplify Team Please look at the issue. @SwaySway

nniirraavv avatar Dec 29 '20 06:12 nniirraavv