1. A method comprising: accessing, at one or more computing devices, a query from a first user, the query comprising a first user attribute; identifying, by the one or more computing devices, a plurality of candidate users sharing the same first user attribute; retrieving, by the one or more computing devices, one or more members of a social-networking system who are connected to the first user within a threshold degree of separation; comparing, by the one or more computing devices, each candidate user with each member who is connected to the first user within the threshold degree of separation; and if a candidate user matches a member who is connected to the first user within the threshold degree of separation, then identifying the matching candidate user as a match result to the query.