AppleScript: Find records with a specific name

How can we find records with a specific name? The lookup record with/exists record with commands looked like the right fit at first, but none of the variants support name.

The search command supports every query that works in a toolbar search.

Or a simply brute force approach using only AppleScript, whose queries are actually not that slow.

tell application id "DNtp" to return contents of current database whose name is "DesiredName"

Thank you both! I did bang my head on records of db; I didn’t notice contents. That works and feels more elegant than using the search command. The search command mostly works, but a query like scope:«dbname» name==«name» can have problems if «name» happens to contain query tokens.

Can you provide an problematic example name?