1. A method for searching a document collection that includes a plurality of documents that are respectively associated with one or more categories and contain terms, the method comprising: providing an index of the terms indicating the documents in which the terms appear; estimating a first statistical distribution of each of at least some of the terms in the index and a second statistical distribution of each of at least some of the categories over the documents in the collection; accepting a query comprising one or more of the terms and a category restriction referring to at least one of the categories; operating on the first estimated statistical distribution of at least one of the terms in the query using the second estimated statistical distribution of the at least one of the categories, responsively to the category restriction, so as to produce a modified term distribution; and applying the query to the index so as to return a response in which occurrences of the at least one of the terms are scored responsively to the modified term distribution.