5. The method of claim 1 , wherein identifying the one or more objects of the second type comprises: accessing an inverted index of the second data store corresponding to the second object type, wherein the inverted index maps a user node to one or more concept nodes in accordance with a second relationship; and retrieving the one or more objects of the second object type requested by the inner query using the inverted index of the second data store corresponding to the second object type, wherein the one or more objects of the second object type comprise one or more concept nodes of a social graph in the social-networking system, and the one or more concept nodes are related, by the second relationship, to a user specified in the inner query.
1. A method comprising, by one or more computing devices: receiving, from a client system of a first user of an online social network, a search query for one or more objects of a first object type, wherein the search query is parsed to identify an inner query and an outer query, wherein the inner query requests one or more objects of a second object type stored in a second data store that stores only objects of the second object type, and wherein the outer query requests the one or more objects of the first object type stored in a first data store that stores only objects of the first object type; identifying, in response to receiving the search query, the one or more objects of the second object type requested by the inner query using an inverted index of the second data store corresponding to the second object type; identifying the one or more objects of the first object type requested by the outer query using one or more of the identified objects of the second object type and a forward index of the second data store corresponding to the second object type, wherein the one or more identified objects of the first object type are related within the online social network to one or more of the identified objects of the second object type; and sending, to the client system of the first user, one or more search results responsive to the search query, each search result corresponding to an identified object of the first object type from the first data store.