Class BlendedInfixSuggester
java.lang.Object
org.apache.lucene.search.suggest.Lookup
org.apache.lucene.search.suggest.analyzing.AnalyzingInfixSuggester
org.apache.lucene.search.suggest.analyzing.BlendedInfixSuggester
- All Implemented Interfaces:
Closeable,AutoCloseable
Extension of the AnalyzingInfixSuggester which transforms the weight
after search to take into account the position of the searched term into
the indexed text.
Please note that it increases the number of elements searched and applies the
ponderation after. It might be costly for long suggestions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe different types of blender.Nested classes/interfaces inherited from class org.apache.lucene.search.suggest.Lookup
Lookup.LookupPriorityQueue, Lookup.LookupResult -
Field Summary
FieldsFields inherited from class org.apache.lucene.search.suggest.analyzing.AnalyzingInfixSuggester
DEFAULT_MIN_PREFIX_CHARSFields inherited from class org.apache.lucene.search.suggest.Lookup
CHARSEQUENCE_COMPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionBlendedInfixSuggester(Version matchVersion, File indexPath, Analyzer analyzer) Create a new instance, loading from a previously built directory, if it exists.BlendedInfixSuggester(Version matchVersion, File indexPath, Analyzer indexAnalyzer, Analyzer queryAnalyzer, int minPrefixChars, BlendedInfixSuggester.BlenderType blenderType, int numFactor) Create a new instance, loading from a previously built directory, if it exists. -
Method Summary
Modifier and TypeMethodDescriptionlookup(CharSequence key, boolean onlyMorePopular, int num) Look up a key and return possible completion for this key.lookup(CharSequence key, int num, boolean allTermsRequired, boolean doHighlight) Retrieve suggestions, specifying whether all terms must match (allTermsRequired) and whether the hits should be highlighted (doHighlight).Methods inherited from class org.apache.lucene.search.suggest.analyzing.AnalyzingInfixSuggester
build, close, getCount, load, sizeInBytes, store
-
Field Details
-
DEFAULT_NUM_FACTOR
public static int DEFAULT_NUM_FACTORDefault factor
-
-
Constructor Details
-
BlendedInfixSuggester
public BlendedInfixSuggester(Version matchVersion, File indexPath, Analyzer analyzer) throws IOException Create a new instance, loading from a previously built directory, if it exists.- Throws:
IOException
-
BlendedInfixSuggester
public BlendedInfixSuggester(Version matchVersion, File indexPath, Analyzer indexAnalyzer, Analyzer queryAnalyzer, int minPrefixChars, BlendedInfixSuggester.BlenderType blenderType, int numFactor) throws IOException Create a new instance, loading from a previously built directory, if it exists.- Parameters:
blenderType- Type of blending strategy, see BlenderType for more precisionsnumFactor- Factor to multiply the number of searched elements before ponderate- Throws:
IOException- If there are problems opening the underlying Lucene index.
-
-
Method Details
-
lookup
Description copied from class:LookupLook up a key and return possible completion for this key.- Overrides:
lookupin classAnalyzingInfixSuggester- Parameters:
key- lookup key. Depending on the implementation this may be a prefix, misspelling, or even infix.onlyMorePopular- return only more popular resultsnum- maximum number of results to return- Returns:
- a list of possible completions, with their relative weight (e.g. popularity)
-
lookup
public List<Lookup.LookupResult> lookup(CharSequence key, int num, boolean allTermsRequired, boolean doHighlight) Description copied from class:AnalyzingInfixSuggesterRetrieve suggestions, specifying whether all terms must match (allTermsRequired) and whether the hits should be highlighted (doHighlight).- Overrides:
lookupin classAnalyzingInfixSuggester
-