1. A computer-implemented method of processing a visual query comprising: on a server system having one or more processors and memory storing one or more programs for execution by the one or more processors: receiving a visual query from a client system; performing optical character recognition (OCR) on the visual query to produce text recognition data representing a plurality of textual characters, including a plurality of textual characters in a contiguous region of the visual query; scoring each textual character in the plurality of textual characters based on at least high quality textual character scores and low quality textual character scores of other textual characters surrounding the textual character, wherein the scoring of each textual character is based, in part, on a transition cost associated with each textual character such that each textual character will score more similarly to the other textual characters surrounding the textual character as the transition cost increases; identifying one or more high quality text segments in the contiguous region of the visual query in accordance with a determination that a respective high quality text segment of the one or more high quality text segments comprises a plurality of high scoring textual characters; identifying a document containing at least one high quality text segment of the one or more high quality text segments; retrieving the document containing the at least one high quality text segment; and sending at least a portion of the document to the client system.