|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.search.suggest.Lookup org.apache.lucene.search.suggest.analyzing.AnalyzingInfixSuggester org.apache.lucene.search.suggest.analyzing.BlendedInfixSuggester
public class BlendedInfixSuggester
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 | |
---|---|
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 | |
---|---|
static int |
DEFAULT_NUM_FACTOR
Default factor |
protected static double |
LINEAR_COEF
Coefficient used for linear blending |
Fields inherited from class org.apache.lucene.search.suggest.analyzing.AnalyzingInfixSuggester |
---|
DEFAULT_MIN_PREFIX_CHARS, indexAnalyzer, payloadsDV, queryAnalyzer, searcher, TEXT_FIELD_NAME, textDV, weightsDV |
Fields inherited from class org.apache.lucene.search.suggest.Lookup |
---|
CHARSEQUENCE_COMPARATOR |
Constructor Summary | |
---|---|
BlendedInfixSuggester(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 | |
---|---|
protected double |
calculateCoefficient(int position)
Calculate the weight coefficient based on the position of the first matching word. |
protected List<Lookup.LookupResult> |
createResults(TopDocs hits,
int num,
CharSequence key,
boolean doHighlight,
Set<String> matchedTokens,
String prefixToken)
Create the results based on the search hits. |
protected FieldType |
getTextFieldType()
Subclass can override this method to change the field type of the text field e.g. |
List<Lookup.LookupResult> |
lookup(CharSequence key,
boolean onlyMorePopular,
int num)
Look up a key and return possible completion for this key. |
List<Lookup.LookupResult> |
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 |
---|
addNonMatch, addPrefixMatch, addWholeMatch, build, close, finishQuery, getCount, getDirectory, getIndexWriterConfig, getLastTokenQuery, highlight, load, sizeInBytes, store |
Methods inherited from class org.apache.lucene.search.suggest.Lookup |
---|
build, load, store |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static double LINEAR_COEF
public static int DEFAULT_NUM_FACTOR
Constructor Detail |
---|
public BlendedInfixSuggester(Version matchVersion, File indexPath, Analyzer analyzer) throws IOException
IOException
public BlendedInfixSuggester(Version matchVersion, File indexPath, Analyzer indexAnalyzer, Analyzer queryAnalyzer, int minPrefixChars, BlendedInfixSuggester.BlenderType blenderType, int numFactor) throws IOException
blenderType
- Type of blending strategy, see BlenderType for more precisionsnumFactor
- Factor to multiply the number of searched elements before ponderate
IOException
- If there are problems opening the underlying Lucene index.Method Detail |
---|
public List<Lookup.LookupResult> lookup(CharSequence key, boolean onlyMorePopular, int num)
Lookup
lookup
in class AnalyzingInfixSuggester
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
public List<Lookup.LookupResult> lookup(CharSequence key, int num, boolean allTermsRequired, boolean doHighlight)
AnalyzingInfixSuggester
allTermsRequired
) and whether the hits
should be highlighted (doHighlight
).
lookup
in class AnalyzingInfixSuggester
protected FieldType getTextFieldType()
AnalyzingInfixSuggester
getTextFieldType
in class AnalyzingInfixSuggester
protected List<Lookup.LookupResult> createResults(TopDocs hits, int num, CharSequence key, boolean doHighlight, Set<String> matchedTokens, String prefixToken) throws IOException
AnalyzingInfixSuggester
createResults
in class AnalyzingInfixSuggester
IOException
- If there are problems reading fields from the underlying Lucene index.protected double calculateCoefficient(int position)
position
- of the first matching word in text
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |