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.1 Reply
I queried the DB directory with SQL, the result is correct. So I expect is somthing in Prisma ORM doing something weird.