If I use the Prisma explorer or MySql Workbench I get the correct query Result but with queryRaw
in my code, I get numbers that slightly vary from the correct result. I can't figure out whats wrong and nedd help :) Thx!
SELECT * FROM (
SELECT name, steamid, MATCH (name) AGAINST (${name}) AS relevance FROM players ORDER BY relevance DESC LIMIT 10
) as x
WHERE relevance > 0
The correct result from Workbench or Prisma Explorer (name='jona')
Jona 76561199076734574 16.340665817260742
Jona 76561198218642855 16.340665817260742
Incorrect result from queryRaw
"players": [
{
"name": "Jona",
"steamid": 76561198218642850,
"relevance": 16.340665817260742
},
{
"name": "Jona",
"steamid": 76561199076734580,
"relevance": 16.340665817260742
}
]
My Code
const players = await prisma.$queryRaw`
SELECT * FROM (
SELECT name, steamid, MATCH (name) AGAINST (${name}) AS relevance FROM players ORDER BY relevance DESC LIMIT 10
) as x
WHERE relevance > 0
`;
Prisma Schema
model players {
steamid BigInt @id @unique(map: "steamid") @db.UnsignedBigInt
name String @db.VarChar(32)
kills Int @db.UnsignedMediumInt
pvpdeaths Int @db.UnsignedMediumInt
pvedeaths Int @db.UnsignedMediumInt
suicides Int @db.UnsignedMediumInt
first_time_seen DateTime @default(now()) @db.Timestamp(0)
player_achievements player_achievements[]
player_wipe_stats player_wipe_stats?
pvelog_with_dublicates pvelog_with_dublicates[] @ignore
@@fulltext([name], map: "name")
}
I have checked if the in put is correct and it should be. I also think the schema is correct because it works in the Explorer. So i think the error is in my code thit the `queryRaw` funtion.