1. A computer-implemented method comprising: receiving a search query including a query term; receiving a document identified as being responsive to the search query; obtaining a synonym that a synonym rule identifies as a substitute for the query term in 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.