lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: Lucene Free Text Suggester, get only single tokens as suggestion!
Date Mon, 13 Oct 2014 10:12:52 GMT
The problem is, your Dictionary is enumerating the analyzed (by
WhitespaceAnalyzer) terms, so you will always only see a single token

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

On Mon, Oct 13, 2014 at 5:07 AM, andi rexha <> 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);
>    ;
> 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,
>   ;
> 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:
For additional commands, e-mail:

View raw message