1. A computer program product stored on one or more non-transitory computer readable storage media and comprising instructions that, when executed, cause an apparatus to: determine, for a document that contains a first phrase, an expected number of related phrases that are related to the first phrase and are expected to be present in the document; determine for the document, and for the first phrase in the document, an actual number of related phrases present in the document; and identify the document as a spam document by comparing the actual number of related phrases present in the document with the expected number of related phrases, wherein determining the expected number of related phrases includes: traversing an index of a plurality of documents; for each of the indexed documents, determining a set of phrases in the document, and for each phrase in the set, determining a number of related phrases also in the document; and determining the expected number of related phrases based on the determined number of related phrases across the traversed documents.