Search text with Prisma
Hello, guys! I am trying to create a search functionality with prisma and want to ask which is the better way: making it with the
search
prop or making it with contains
prop. Now I am using search and it looks like this
2 Replies
Hi @bockster6669
If your search requirements are simple and you are only looking for substring matches,
contains
prop might be sufficient. For more complex search needs, especially if you are using PostgreSQL or MySQL, sticking with search
prop is advisable. search
prop allows for more advanced full-text search capabilities, including the use of query operators. See this section of the documentation.Full-text search (Preview) | Prisma Documentation
This page explains how to search for text within a field.
hi, thank you, but can you help for this now? I am having strange problem, why when formattedQuery is
undefined
it doesn't finds any posts, but if I refer directly undefined
to search
then it finds all posts?
For example*
I can use
and this will work find, the posts will not be sorted by any mean
but I can not use
This will not work! I am getting error: