SpotlightQuery searches for files & [quote]mdls – lists the metadata attributes for the specified file[/quote] taken from manual page for mdls…two different things.
The shell version of SpotlightQuery: mdfind has the ability to limit the search to a given directory with the -onlyin option…which you can’t do with SpotlightQuery.