public class SuggestField extends Field
Field that indexes a string value and a weight as a weighted completion against a named suggester. Field is tokenized, not stored and stores documents, frequencies and positions. Field can be used to provide near real time document suggestions.
Besides the usual Analyzers,
CompletionAnalyzer
can be used to tune suggest field only parameters
(e.g. preserving token seperators, preserving position increments
when converting the token stream to an automaton)
Example indexing usage:
document.add(new SuggestField(name, "suggestion", 4));To perform document suggestions based on the this field, use
SuggestIndexSearcher.suggest(String, CharSequence, int, org.apache.lucene.search.Filter)
Example query usage:
SuggestIndexSearcher indexSearcher = .. indexSearcher.suggest(name, "su", 2)
Field.Index, Field.Store, Field.TermVectorboost, fieldsData, name, tokenStream, type| Constructor and Description |
|---|
SuggestField(String name,
String value,
long weight)
Creates a
SuggestField |
| Modifier and Type | Method and Description |
|---|---|
TokenStream |
tokenStream(Analyzer analyzer,
TokenStream reuse) |
binaryValue, boost, fieldType, name, numericValue, readerValue, setBoost, setBytesValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, stringValue, tokenStreamValue, toString, translateFieldTypepublic SuggestField(String name, String value, long weight)
SuggestFieldname - of the fieldvalue - to get suggestions onweight - weight of the suggestionpublic TokenStream tokenStream(Analyzer analyzer, TokenStream reuse) throws IOException
tokenStream in interface IndexableFieldtokenStream in class FieldIOExceptionCopyright © 2000-2015 Apache Software Foundation. All Rights Reserved.