Full text search on a given field in ash expression?
I have a table, which emits the map like
%{question_text: "filter keyword that should exist"}
I am composing queries like
Here are other things I have tried.
I need a simple ilike style stuff for now.5 Replies
AshPostgres
resources get an ilike
function out of the box
Ash.Query.filter(ilike(^ref(key), ^"%#{value}%"))
for exampleGitHub
ash_authentication/test/support/example_multi_tenant/only_marties_a...
The Ash Authentication framework. Contribute to team-alembic/ash_authentication development by creating an account on GitHub.
Just did github code search.
one more question --
Can
ilike
be used outside filter?
like, I want to compose Ash.Expr
and then pass all of them in a filter at once.
Code related to this
if I use the key
as atom, then the error is
Ah. I had to pin the value
too!when I'm building references, I often use a helper function, something like:
this way you can use a field that references a relationship or a field that belongs on the resource itself and have a single way to parse it out. in the example above, path would be a list of atoms that points to the target resource, so it could be something like
{[:author], :email}
; when done that way, you'll just need to pin the result of parse_field/1
. something like:
Super useful.