1. A method performed by a computer with a processor, comprising: receiving a search query containing a representation of a text string having a plurality of search terms and identifying the search terms as being separated by spaces; accessing, with the processor, a lexicon of terms stored in a memory; generating, with the processor, a plurality of candidate spellings for each search term in the query based on a spelling similarity, a phonetic similarity, and a word boundary similarity, between the search terms and the terms in the lexicon, and organizing the candidate spellings in a structure to group candidate spellings for each search term; assigning a score to each of the candidate spellings based on the spelling similarity, the phonetic similarity and the word boundary similarity; generating, with the processor, a plurality of candidate query paths through the structure based on the scores that were previously assigned for each candidate spelling, each candidate query path containing a candidate spelling for each search term in the search query; determining, with the processor, a relationship among the candidate spellings in each candidate query path; and ranking, with a ranking model, the candidate query paths as a function of the scores of each candidate spelling and the relationship, the ranking model being generated by obtaining a set of feature functions for the ranking model that ranks candidate query paths of suggested spelling corrections given a search query; generating, with the processor, a weight for each feature function in the set of feature functions to create weighted ranking parameters for the ranking model; accessing, with a processor, a plurality of samples, each sample having a query and an expected spelling suggestion for the query; employing the ranking model to rank candidate paths generated for each query; and adjusting the weights for the weighted ranking parameters based on the ranking applied to the candidate paths for the plurality of samples.