1. A method comprising, by one or more computing devices: receiving from a first user of an online social network an unstructured text query comprising one or more n-grams, the online social network being associated with a social graph comprising a plurality of nodes and a plurality of edges connecting the nodes; identifying one or more of the nodes, each of the identified nodes corresponding to one or more of the n-grams; identifying one or more of the edges, each of the identified edges being connected to at least one of the identified nodes, each of the identified edges corresponding to one or more of the n-grams; and generating one or more structured queries that each comprise references to one or more of the identified nodes and one or more of the identified edges.