Chapter 7: create Search term query

How can I create a ‘contains’ query? And add this to the group query?
so you can search for ‘my’ or ‘god’ instead of Oh+My+God

@yoyohu import FluentSQL and then you should be able to do

try or.filter(\Acronym.long ~~ searchTerm)
6 Likes

Correct!
thanks!
Where do I find this in the docs?
i have missed this operator at:
https://docs.vapor.codes/2.0/fluent/query/

my bad:
I see now…
coming soon :wink:
https://docs.vapor.codes/3.0/fluent/query-builder/

Yep will be coming with the release! But the source and tests are the best place

“~” operator not working now. How do you do now?

@0xtim Can you please help with this when you get a chance? Thank you - much appreciated! :]

It can be solved with “~=”. Hope this can help someone someday

2 Likes

@pyae Thank you for sharing the solution - much appreciated! :]