11. A non-transitory computer readable storage medium storing instructions which, when executed by one or more processors, cause the one or more processors to: receive a partial query entered by a user into a search field in a user interface on a computing device, and receive data indicating a document displayed on the computing device during entry of the partial query, wherein the user interface displays the document within an application different from an application including the search field, wherein at least one of the applications is different from a web browser, wherein the document includes content comprising metadata and text, and wherein the text includes terms; identify query completions for the partial query based on one or more terms of the partial query, wherein at least one query completion of the query completions includes the one or more terms of the partial query and at least one term from the document that is different and in addition to the one or more terms of the partial query; identify initial ranking scores for the query completions, wherein the initial ranking score for the at least one query completion is based at least in part on popularity of the at least one query completion; calculate similarity scores for the query completions, wherein calculating a similarity score for a given query completion of the query completions is based at least in part on similarity between the given query completion and the content in the displayed document; rank the query completions based on the similarity scores and the initial ranking scores; selecting one or more of the query completions as refined query completions for the partial query based at least in part on the rank; and provide the refined query completions for display on the computing device.
11. A non-transitory computer readable storage medium storing instructions which, when executed by one or more processors, cause the one or more processors to: receive a partial query entered by a user into a search field in a user interface on a computing device, and receive data indicating a document displayed on the computing device during entry of the partial query, wherein the user interface displays the document within an application different from an application including the search field, wherein at least one of the applications is different from a web browser, wherein the document includes content comprising metadata and text, and wherein the text includes terms; identify query completions for the partial query based on one or more terms of the partial query, wherein at least one query completion of the query completions includes the one or more terms of the partial query and at least one term from the document that is different and in addition to the one or more terms of the partial query; identify initial ranking scores for the query completions, wherein the initial ranking score for the at least one query completion is based at least in part on popularity of the at least one query completion; calculate similarity scores for the query completions, wherein calculating a similarity score for a given query completion of the query completions is based at least in part on similarity between the given query completion and the content in the displayed document; rank the query completions based on the similarity scores and the initial ranking scores; selecting one or more of the query completions as refined query completions for the partial query based at least in part on the rank; and provide the refined query completions for display on the computing device. 13. The non-transitory computer readable storage medium of claim 11 , wherein the instructions which cause the one or more processors to select one or more of the query completions as refined query completions for the partial query comprise instructions which cause the one or more processors to select a predetermined number of highest ranked of the query completions as the refined query completions.