Hey all, What are best practice when it comes to ...
# orm-help
a
Hey all, What are best practice when it comes to Fuzzy search of string or just something like LIKE in SQL for prisma?
n
Hey Andreas πŸ‘‹ you can use
contains
,
startsWith
and
endWith
in a Prisma Client query, e.g.:
Copy code
const draftPosts = await prisma.post.findMany({
  where: {
    title: {contains: searchString,},
  },
})
Did that help @Andreas Harmuth or do you still have questions about this? πŸ™‚
a
Hmm contains, startsWith and endWith are not really fuzzy search. Let's say I want to search for
Andreas Harmuth
then I want
Andreas Hartmuth
to still return me the
Andreas Harmuth
The same with lower + upper case
n
Ah sorry, I should have read your message more carefully – only focused on
LIKE
πŸ€¦β€β™‚οΈ fuzzy search is not yet available via dedicated model queries, but you can still use it using raw SQL queries. It would actually be great if you could open a feature request with your exact use case for fuzzy search so that our product and engineering teams can look into implementing it πŸ™‚
a
Will do!
πŸ™ 1
n
Case insensitivity is already supported though, you can learn about it in the docs here: https://www.prisma.io/docs/concepts/components/prisma-client/case-sensitivity