You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Users need to be able to find someone by their first name, second name, or surname, from a single filtering text input using ILIKE.
So you need to derive the schema like this:
However, any filter request will crash because Flop will apply ILIKE to the names field which is an array, and postgres will say character varying[] ~~* unknown.
So, let's just use postgres function array_to_string to flatten the array before applying the ILIKE operator. First, let's create a custom field
Now let's add the custom field to the compound field so we can search through all the fields at once!
And that's where elixir compiler ruins your joy with the following message from Flop library:
Compound fields must reference existing fields, but :info
references:
[:names_string]
So:
is this a bug that should be corrected to become a new feature? (being able to use custom fields in compound fields)
does one have a better idea on how to do this without using a custom field?
My next idea is to store the string array as a string of comma-separated values, but I'd like to have your opinions first.
Thanks for your help!
The text was updated successfully, but these errors were encountered:
Alternate title: custom field inside compound field.
Hello,
Let's say you have this schema:
Users need to be able to find someone by their first name, second name, or surname, from a single filtering text input using
ILIKE
.So you need to derive the schema like this:
And add a filter field like this:
However, any filter request will crash because Flop will apply
ILIKE
to thenames
field which is an array, and postgres will saycharacter varying[] ~~* unknown
.So, let's just use postgres function
array_to_string
to flatten the array before applying the ILIKE operator. First, let's create a custom fieldand a filter (which I restricted to ilike for simplification):
And it works!
Now let's add the custom field to the compound field so we can search through all the fields at once!
And that's where elixir compiler ruins your joy with the following message from Flop library:
So:
My next idea is to store the string array as a string of comma-separated values, but I'd like to have your opinions first.
Thanks for your help!
The text was updated successfully, but these errors were encountered: