-
For example, I want to search "hello world" from posts: SELECT * FROM posts
WHERE (title LIKE '%hello%' OR content LIKE '%hello%')
AND (title LIKE '%world%' OR content LIKE '%world%'); How to achieve this with Adonis' query builder? |
Beta Was this translation helpful? Give feedback.
Answered by
guoyunhe
Jul 22, 2023
Replies: 1 comment
-
Found this solution, using where groups search.split(' ').forEach((word) => {
query.where((q) => {
q.whereILike('title', `%${word}%`).orWhereILike('content', `%${word}%`);
});
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
guoyunhe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Found this solution, using where groups