Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

90
Views
Weird query result of prisma.queryRaw

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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!