Dancing Crow
Explore posts from serversPPrisma
•Created by Dancing Crow on 6/25/2024 in #help-and-questions
What's the proper way for me to define tsvector field in my schema file?
I defined a trigger function that will update the search_data column. I'm not sure how I should define the prisma schema in this case. I'm getting weird result with filtering. For example I have these entries: Apple, Banana, Orange. When I define
"data_search" @@ to_tsquery('english', ${searchTerm})
with searchTerm=Orange
it returns Orange correctly. But when I'm not doing any where clause, Orange is not returned.
Here's the actually model definition:
And here's my query
I have an if/else case to determine to use the above or the below without tsquery
Also take suggestion if there's better than if/else for with searchTerm vs. not. Thanks.3 replies