Garrick Chippendale
11/16/2021, 4:11 PMOrder by relevance in full text search (PostgreSQL)
, and maybe im misunderstanding it, but im having an issue:
const cards = await prisma.card.findMany({
include: {
character: true,
creator: true
},
where: {
character: {
name: {
contains: value,
mode: 'insensitive'
}
},
user_id: member.user.id
},
take: 10,
// Here <-------------
orderBy: {
_relevance: {
fields: [{ character: ['name'] }],
search: value,
sort: 'desc'
}
}
});
this definitely fails, because i just made up/guessed the syntax for fields
, but the only 2 fields i can input are the unique fields, which are just the IDs that arent useful at all for search/ordering/etc. it only lets me put user_id
and creator_id
as the fields, but i would expect i can sort by the character.name
which is the important string that the user is searching for.Ryan
11/17/2021, 10:30 AMGarrick Chippendale
11/17/2021, 4:36 PMRyan
11/18/2021, 7:21 AM