Unfortunately DirectSpellChecker operates only on one "term" at a time (where term = whatever tokens were indexed into that field).
I agree it'd be wonderful to have an API that takes a whole query, tokenizes it, runs suggest on each word, and puts it back together into a simple "Did you mean?" It'd be even better if it took context into account to get better corrections ... but we just don't have that API yet (patches welcome!!). Mike McCandless http://blog.mikemccandless.com On Tue, Jan 8, 2013 at 7:39 AM, algebra <fabianoc...@gmail.com> wrote: > Thanks Michael, > > I would like to get the suggestion of terms and not just words, for example: > > addDoc(w,"Lucene in Action"); > addDoc(w,"Lucene for Dummies"); > addDoc(w,"Managing Gigabytes"); > addDoc(w,"The Art of Computer Science"); > > main.printSuggests("lucina in",my_reader); > > public void printSuggests(String s, IndexReader ir) throws IOException{ > DirectSpellChecker ds = new DirectSpellChecker(); > Term tm = new Term("title", s); > SuggestWord[] suggestions = ds.suggestSimilar(tm,5,ir); > for (int i=0; i < suggestions.lenght; i++) > System.out.println(suggestions[i].string); > } > > I would like that suggestion was "in lucene" but it does not. Someone can > tell me why? and how do I solve this problem? > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Suggestion-words-in-FuzzyQuery-tp4031354p4031558.html > Sent from the Lucene - Java Developer mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org > For additional commands, e-mail: dev-h...@lucene.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org