search spotlight from terminal
I would like to be able to search spotlight from the terminal.
I'm aware of mdfind, but it doesn't sort by relevance.
ex:
for me, typing "vs" into spotlight returns "Visual Studio Code" as the instant top hit with 17 other options
in contrast `mdfind "vs"` spews hundreds of possibilities, matching any file/folder that has "vs" in it.
I've looked at the man pages and spotlight query syntax, but haven't seen anything about sorting by relevance or partial searches. Sorting by time/date/location is easy, I can do that with the regular unix find command, I just need a way to tap into the "top hits" section of spotlight from terminal.
I imagine there is a debugging tool somewhere that would be able to do this.
I'd also be fine with an Applescript solution since AppleScript can be run through the terminal.
Thanks in advance.