1. A method comprising, by a computing device: receiving, from a client device of a first user, a text query inputted by the first user; generating a set of structured queries based on the text query, each structured query in the set corresponding to a grammar of a context-free grammar model, wherein each structured query is based on a natural-language string generated by a grammar of the context-free grammar model and comprises one or more tokens, wherein one or more of the tokens of each structured query correspond to one or more objects associated with the online social network, respectively; filtering the set to remove one or more structured queries from the set, each removed structured query having a quality score less than a threshold quality score; and sending, to the client device of the first user for display, one or more of the structured queries from the post-filtered set.