docs
docs copied to clipboard
Prisma docs are misleading when sorting by relevance
On this page:
https://www.prisma.io/docs/concepts/components/prisma-client/filtering-and-sorting#sort-by-relevance-postgresql
It gives the example code:
const getUsersByRelevance = await prisma.user.findMany({
take: 10,
orderBy: {
_relevance: {
fields: ['bio'],
search: 'developer',
sort: 'asc',
},
},
})
The sort should probably be set to 'desc'
for most people, if you're using PostgreSQL -- assuming you want the highest relevant results returned first, which I would think the vast majority of people want.