1. A method comprising, by one or more computer systems, performing: receiving a plurality of past queries; identifying among the plurality of past queries a plurality sub-queries each including one or more contiguous words from a past query of the plurality of past queries, the sub-queries including start sub-queries including a starting word of the past query and end sub-queries including an ending word of the past query; for each sub-query, generating a start sub-query count equal to a number of occurrences of the each sub query as a start sub-query; for each sub-query, generating an end sub-query count equal to a number of occurrences of the each sub query as an end sub-query; for each sub-query, generating a score that is a function of the start sub-query count and end sub-query; receiving a query including a plurality of terms; for a plurality of first phrases including contiguous terms of the plurality of terms, determining weights for the first phrases according to the scores of a sub-query of the plurality of sub-queries corresponding to the first phrases; submitting the query to a search engine with the weights for the plurality of first phrases; receiving results from the search engine; and returning the results.