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:
java.io.Closeable
,java.lang.AutoCloseable
public class BlendedInfixSuggester extends AnalyzingInfixSuggester
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 Classes Modifier and Type Class Description static class
BlendedInfixSuggester.BlenderType
The different types of blender.-
Nested classes/interfaces inherited from class org.apache.lucene.search.suggest.Lookup
Lookup.LookupPriorityQueue, Lookup.LookupResult
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_NUM_FACTOR
Default factor-
Fields inherited from class org.apache.lucene.search.suggest.analyzing.AnalyzingInfixSuggester
DEFAULT_MIN_PREFIX_CHARS
-
Fields inherited from class org.apache.lucene.search.suggest.Lookup
CHARSEQUENCE_COMPARATOR
-
-
Constructor Summary
Constructors Constructor Description BlendedInfixSuggester(Version matchVersion, java.io.File indexPath, Analyzer analyzer)
Create a new instance, loading from a previously built directory, if it exists.BlendedInfixSuggester(Version matchVersion, java.io.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Lookup.LookupResult>
lookup(java.lang.CharSequence key, boolean onlyMorePopular, int num)
Look up a key and return possible completion for this key.java.util.List<Lookup.LookupResult>
lookup(java.lang.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
-
-
-
-
Constructor Detail
-
BlendedInfixSuggester
public BlendedInfixSuggester(Version matchVersion, java.io.File indexPath, Analyzer analyzer) throws java.io.IOException
Create a new instance, loading from a previously built directory, if it exists.- Throws:
java.io.IOException
-
BlendedInfixSuggester
public BlendedInfixSuggester(Version matchVersion, java.io.File indexPath, Analyzer indexAnalyzer, Analyzer queryAnalyzer, int minPrefixChars, BlendedInfixSuggester.BlenderType blenderType, int numFactor) throws java.io.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:
java.io.IOException
- If there are problems opening the underlying Lucene index.
-
-
Method Detail
-
lookup
public java.util.List<Lookup.LookupResult> lookup(java.lang.CharSequence key, boolean onlyMorePopular, int num)
Description copied from class:Lookup
Look up a key and return possible completion for this key.- Overrides:
lookup
in 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 java.util.List<Lookup.LookupResult> lookup(java.lang.CharSequence key, int num, boolean allTermsRequired, boolean doHighlight)
Description copied from class:AnalyzingInfixSuggester
Retrieve suggestions, specifying whether all terms must match (allTermsRequired
) and whether the hits should be highlighted (doHighlight
).- Overrides:
lookup
in classAnalyzingInfixSuggester
-
-