Funny experience with a PR reviewed by an AI bot.
It made a few really bad suggestions and cluttered the PR comment section but this one was intriguing enough.
I had a SOSL query similar to this in the PR:
๐ FIND {someone@gmail.com} IN EMAIL FIELDS RETURNING Contact( Id, AccountId, RecordTypeId WHERE RecordTypeId != '012....' ) LIMIT 1
Yet the bot suggested placing the LIMIT 1 inside the parenthesis, like this:
๐ FIND {someone@gmail.com} IN EMAIL FIELDS RETURNING Contact( Id, AccountId, RecordTypeId WHERE RecordTypeId != '012....' LIMIT 1 )
Does it make any difference?
From the documentation: when you set the limit on the entire query, it distributes results among objects.
But in this case we're querying a single object.
Does the LIMIT on the WHERE reduces the number of records on which it will search the email fields?
Or is that implementation intelligent enough to see LIMIT 1 on the outer syntax and auto-apply it on the inner WHERE clause?
๐ค
๐ DOCUMENTATION: https://lnkd.in/gWDbaXnz
https://lnkd.in/gKHKyWmM
