1. A method comprising: determining training data including queries; determining n-grams from own content of each of the queries; determining an n-gram space that represents each of the queries as one or more vectors in the n-gram space, each dimension of the n-gram space being independent and represented by a unique one of the n-grams; and learning a similarity function using the training data, the similarity function based at least in part on a transform of the n-gram space, the transform resulting in a transformed n-gram space having one or more of the unique n-grams being dependent on one or more other of the unique n-grams.