1. A method in a computer system with a processor and memory for determining relevance of a query to a document, the query having query terms, the method comprising: receiving from a user the query; for each of a plurality of documents, identifying spans of query terms within the document with no repeated occurrences of a query term, each span including multiple query terms and having a span width, wherein at least one span includes at least three query terms, wherein a distance between adjacent query terms within a span is less than a threshold distance, and wherein the distance between two query terms is based on the number of non-query terms between the two query terms; for each identified span, calculating a span relevance based on the number of query terms in the span and the inverse of the width of the span; for each query term, aggregating the calculated span relevances for each span that contains the query term into a query term relevance of the query term to the document, wherein the aggregating includes summing the calculated span relevance for each span that contains the query term; and aggregating the query term relevances for the query terms into a document relevance indicating relevance of the document to the query; and displaying an indication of the documents in an order based on the relevance of the documents to the received query.
2. The method of claim 1 wherein the span relevance for a span is calculated based on the following: f ⁡ ( t , espan i ) = n i y Width ⁡ ( espan i ) x where t is a query term, espan i is a span that contains t, n i is the number of query terms that occur in espan i , Width(espan i ) is the span width of espan i , x is an exponent that is used to control the influence of the span width, and y is an exponent that is used to control the influence of the number of query terms in the span.