25. The system of claim 20 , further comprising: accessing a social graph comprising a plurality of nodes and a plurality of edges connecting the nodes, each of the edges between two of the nodes representing a single degree of separation between them, the nodes comprising: a first node corresponding to the first user; and a plurality of second nodes corresponding to a plurality of objects associated with the online social network, respectively.
20. A system comprising: one or more processors; and a memory coupled to the processors comprising instructions executable by the processors, the processors operable when executing the instructions to: receive, from a client device of a first user, a text string comprising one or more characters inputted by the first user; generate a set of suggested queries based on the text string, each suggested query in the set being based on a string generated by a grammar of a grammar model and comprising the text string of the query and one or more tokens inserted by the grammar model corresponding to one or more terms, respectively; calculate, for each suggested query in the set, a quality score based on an insertion cost of the one or more tokens of the suggested query inserted by the grammar model; filter the set to remove one or more suggested queries from the set based on the respective quality scores of the suggested queries; and send, to the client device, one or more of the suggested queries from the post-filtered set for presentation to the first user.