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!