The problem is, your Dictionary is enumerating the analyzed (by WhitespaceAnalyzer) terms, so you will always only see a single token suggested.
You could use KeywordAnalyzer instead, so that the entire string is a single token. But this bloats your index, so it's better to simply build the suggester directly from your strings and skip putting them into a Lucene index, unless you need them indexed for some reason... Mike McCandless http://blog.mikemccandless.com On Mon, Oct 13, 2014 at 5:07 AM, andi rexha <a_re...@hotmail.com> wrote: > Hi! > I have a field in an index for which I want to have a "free text suggestion". > The field is analyzed, storend and term vector the field. I tried to use two > approaches to get the suggestions from the field. > > I have tried to apply the free text suggester with a dictionary like : > > > FreeTextSuggester freeTextSuggester = new FreeTextSuggester(new > WhitespaceAnalyzer(), new WhitespaceAnalyzer(), 2); > Dictionary dict = new LuceneDictionary(reader, field); > freeTextSuggester.build(dict); > > > > I have also tried a different approach, buy using the term vector elements > for each document: > > WFSTCompletionLookup wfstCompletionLookup = new > WFSTCompletionLookup(); > //it iterates over the term vector and is an InputIterator > TermVectorInputIterator termVectorInputIterator = new > TermVectorInputIterator(reader, field); > wfstCompletionLookup.build(termVectorInputIterator); > > > > I have an index with 916 documents, and approximately 32.000 terms, but I > always get as suggestion for a few characters input, single tokens > suggestion, and not n-grams. Does anybody have any suggestion about my > problem? > > Thank you in advance! > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org