A computer-implemented method of processing a visual query comprising: on a server system (106, 110) 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 by an OCR module optical character recognition on the visual query to produce: (a) text recognition data representing textual characters, consisting of a plurality of textual characters in a contiguous region of the visual query; and (b) a confidence level that measures a quality level of the text recognition data representing the textual characters; generate a text segment score for each of one or more text segments in the visual query that characterizes the quality of the text segment, comprising: determining a quality score for each textual character by scoring each textual character in the plurality of textual characters, wherein scoring of a respective textual character includes generating a language-conditional character probability for the respective textual character indicating how well the respective textual character and a set of characters that precede the respective textual character in the text segment concord with a language model, determining a text quality score for each textual character in the text segment by combining the quality score with the confidence level provided by the OCR module; combining the text quality scores associated with the characters in the text segment to generate the text segment score for the text segment; identifying, in accordance with the text segment scores, one or more text segments having a text segment score over a threshold; identifying from a data store a source document containing the one or more identified text segments having a text segment score over the threshold; retrieving the source document containing the one or more identified text segments having a text segment score over the threshold; and sending at least a portion of the source document containing the one or more identified text segments having a text segment score over the threshold to the client system. receiving a visual query from a client system; performing by an OCR module optical character recognition on the visual query to produce: (a) text recognition data representing textual characters, consisting of a plurality of textual characters in a contiguous region of the visual query; and (b) a confidence level that measures a quality level of the text recognition data representing the textual characters; (a) text recognition data representing textual characters, consisting of a plurality of textual characters in a contiguous region of the visual query; and (b) a confidence level that measures a quality level of the text recognition data representing the textual characters; generate a text segment score for each of one or more text segments in the visual query that characterizes the quality of the text segment, comprising: determining a quality score for each textual character by scoring each textual character in the plurality of textual characters, wherein scoring of a respective textual character includes generating a language-conditional character probability for the respective textual character indicating how well the respective textual character and a set of characters that precede the respective textual character in the text segment concord with a language model, determining a text quality score for each textual character in the text segment by combining the quality score with the confidence level provided by the OCR module; combining the text quality scores associated with the characters in the text segment to generate the text segment score for the text segment; determining a quality score for each textual character by scoring each textual character in the plurality of textual characters, wherein scoring of a respective textual character includes generating a language-conditional character probability for the respective textual character indicating how well the respective textual character and a set of characters that precede the respective textual character in the text segment concord with a language model, determining a text quality score for each textual character in the text segment by combining the quality score with the confidence level provided by the OCR module; combining the text quality scores associated with the characters in the text segment to generate the text segment score for the text segment; identifying, in accordance with the text segment scores, one or more text segments having a text segment score over a threshold; identifying from a data store a source document containing the one or more identified text segments having a text segment score over the threshold; retrieving the source document containing the one or more identified text segments having a text segment score over the threshold; and sending at least a portion of the source document containing the one or more identified text segments having a text segment score over the threshold to the client system.