you don't need that, the contacts api already does that when using "contains" (see https://mxr.mozilla.org/mozilla-central/source/dom/contacts/fallback/ContactDB.jsm#676)