8. A non-transitory computer storage medium encoded with a computer program, the program comprising instructions that when executed by data processing apparatus cause the data processing apparatus to perform operations comprising: receiving a search query and a geographic region associated with the search query, the geographic region having a central location and a bounding polygon; identifying a plurality of candidate search results responsive to the search query, each candidate search result specifying a geographic location; calculating, for each candidate search result, a central distance score, wherein the central distance score comprises a score based on a first geographic distance between the geographic location of the candidate search result and the central location of the geographic region; calculating, for each candidate search result, a polygon distance score, wherein the polygon distance score changes as a scoring function of a second geographic distance between the geographic location of the candidate search result and an edge of the bounding polygon of the geographic region nearest the geographic location of the candidate search result, wherein the scoring function uses the second geographic distance as an input and the polygon distance score is subject to a score limit; calculating, for each candidate search result, a respective location relevance score based on the central distance score and the polygon distance score for the candidate search result; and ranking the plurality of candidate search results based at least in part on the calculated location relevance scores of the plurality of candidate search results.
8. A non-transitory computer storage medium encoded with a computer program, the program comprising instructions that when executed by data processing apparatus cause the data processing apparatus to perform operations comprising: receiving a search query and a geographic region associated with the search query, the geographic region having a central location and a bounding polygon; identifying a plurality of candidate search results responsive to the search query, each candidate search result specifying a geographic location; calculating, for each candidate search result, a central distance score, wherein the central distance score comprises a score based on a first geographic distance between the geographic location of the candidate search result and the central location of the geographic region; calculating, for each candidate search result, a polygon distance score, wherein the polygon distance score changes as a scoring function of a second geographic distance between the geographic location of the candidate search result and an edge of the bounding polygon of the geographic region nearest the geographic location of the candidate search result, wherein the scoring function uses the second geographic distance as an input and the polygon distance score is subject to a score limit; calculating, for each candidate search result, a respective location relevance score based on the central distance score and the polygon distance score for the candidate search result; and ranking the plurality of candidate search results based at least in part on the calculated location relevance scores of the plurality of candidate search results. 10. The computer storage medium of claim 8 , wherein the polygon distance score is based on a piece-wise continuous function that is continuous across the polygon boundary, the piece-wise continuous function having a first part that increases with the second geographic distance when the geographic location is within the bounding polygon and a second part that decreases with the second geographic distance when the geographic location is outside of the bounding polygon, and wherein the instructions cause the data processing apparatus to further perform operations comprising: determining, for each candidate search result, whether the geographic location is within the bounding polygon; and calculating the polygon distance score using the first part of the piece-wise continuous function if the geographic location is within the bounding polygon and using the second part of the piece-wise continuous function if the geographic location is outside of the bounding polygon.