1. A method comprising: receiving, from a client system of a first user of an online social network, a structured query comprising references to one or more selected objects associated with the online social network; generating a query command based on the structured query, wherein the query command comprises an inner query constraint and an outer query constraint; identifying a first set of objects matching the inner query constraint and at least in part matching the outer query constraint; identifying a second set of objects matching the outer query constraint; and generating one or more search results based on the first and second sets of objects, wherein each search result corresponds to an object of the plurality of objects.