19. A computer program product, encoded on one or more non-transitory computer storage media, comprising instructions that when executed by one or more computers cause the one or more computers to perform operations: receiving a search query including a query term; receiving a document identified as being responsive to the search query; receiving an indication that the synonym of the query term in the search query is designated as a restricted-locality synonym; in response to receiving the indication that the synonym is designated as a restricted-locality synonym, selecting a first scoring model that specifies how to score occurrences of restricted-locality synonyms in documents, wherein the first scoring model is different than a second scoring model that specifies how to score occurrences of query terms or synonyms that are not designated as a restricted-locality synonym in documents, wherein the first scoring model specifies that a document score for the document depends on whether occurrences of the restricted-locality synonym in the document co-occur in the document with one or more query terms or one or more synonyms of the query term; and determining a document score for the document using the first scoring model.
22. The computer program product of claim 19 , wherein the first scoring model defines a demotion of the document score.