Class AnalyzingInfixSuggester
Analyzes the input text and then suggests matches based on prefix matches to any tokens in the indexed text. This also highlights the tokens that match.
This suggester supports payloads. Matches are sorted only by the suggest weight; it would be nice to support blended score + weight sort in the future. This means this suggester best applies when there is a strong a-priori ranking of all the suggestions.
This suggester supports contexts, however the contexts must be valid utf8 (arbitrary binary terms will not work). @lucene.experimental
Inherited Members
Assembly: Lucene.Net.Suggest.dll
Syntax
public class AnalyzingInfixSuggester : Lookup, IDisposable
Constructors
Name | Description |
---|---|
AnalyzingInfixSuggester(LuceneVersion, Store.Directory, Analyzer) | Create a new instance, loading from a previously built AnalyzingInfixSuggester directory, if it exists. This directory must be private to the infix suggester (i.e., not an external Lucene index). Note that Dispose() will also dispose the provided directory. |
AnalyzingInfixSuggester(LuceneVersion, Store.Directory, Analyzer, Analyzer, Int32) | Create a new instance, loading from a previously built AnalyzingInfixSuggester directory, if it exists. This directory must be private to the infix suggester (i.e., not an external Lucene index). Note that Dispose() will also dispose the provided directory. |
Fields
Name | Description |
---|---|
CONTEXTS_FIELD_NAME | Field name used for the indexed context, as a
|
DEFAULT_MIN_PREFIX_CHARS | Default minimum number of leading characters before PrefixQuery is used (4). |
EXACT_TEXT_FIELD_NAME | Field name used for the indexed text, as a
|
m_indexAnalyzer | Analyzer used at index time |
m_queryAnalyzer | Analyzer used at search time |
m_searcherMgr | |
TEXT_FIELD_NAME | Field name used for the indexed text. |
Properties
Name | Description |
---|---|
Count |
Methods
Name | Description |
---|---|
Add(BytesRef, IEnumerable<BytesRef>, Int64, BytesRef) | Adds a new suggestion. Be sure to use Update(BytesRef, IEnumerable<BytesRef>, Int64, BytesRef) instead if you want to replace a previous suggestion. After adding or updating a batch of new suggestions, you must call Refresh() in the end in order to see the suggestions in DoLookup(String, IEnumerable<BytesRef>, Int32, Boolean, Boolean) |
AddNonMatch(StringBuilder, String) | Called while highlighting a single result, to append a non-matching chunk of text from the suggestion to the provided fragments list. |
AddPrefixMatch(StringBuilder, String, String, String) | Called while highlighting a single result, to append a matched prefix token, to the provided fragments list. |
AddWholeMatch(StringBuilder, String, String) | Called while highlighting a single result, to append the whole matched token to the provided fragments list. |
Build(IInputIterator) | |
CreateResults(IndexSearcher, TopFieldDocs, Int32, String, Boolean, IEnumerable<String>, String) | Create the results based on the search hits. Can be overridden by subclass to add particular behavior (e.g. weight transformation) |
Dispose() | |
DoLookup(String, IEnumerable<BytesRef>, Boolean, Int32) | |
DoLookup(String, IEnumerable<BytesRef>, Int32, Boolean, Boolean) | Retrieve suggestions, specifying whether all terms
must match ( |
DoLookup(String, Int32, Boolean, Boolean) | Lookup, without any context. |
FinishQuery(BooleanQuery, Boolean) | Subclass can override this to tweak the Query before searching. |
GetDirectory(DirectoryInfo) | Subclass can override to choose a specific
|
GetIndexWriterConfig(LuceneVersion, Analyzer, OpenMode) | Override this to customize index settings, e.g. which codec to use. |
GetLastTokenQuery(String) | This is called if the last token isn't ended
(e.g. user did not type a space after it). Return an
appropriate |
GetSizeInBytes() | |
GetTextFieldType() | Subclass can override this method to change the field type of the text field e.g. to change the index options |
Highlight(String, IEnumerable<String>, String) | Override this method to customize the Object representing a single highlighted suggestions; the result is set on each HighlightKey member. |
Load(DataInput) | |
Refresh() | Reopens the underlying searcher; it's best to "batch up" many additions/updates, and then call refresh once in the end. |
Store(DataOutput) | |
Update(BytesRef, IEnumerable<BytesRef>, Int64, BytesRef) | Updates a previous suggestion, matching the exact same text as before. Use this to change the weight or payload of an already added suggstion. If you know this text is not already present you can use Add(BytesRef, IEnumerable<BytesRef>, Int64, BytesRef) instead. After adding or updating a batch of new suggestions, you must call Refresh() in the end in order to see the suggestions in DoLookup(String, IEnumerable<BytesRef>, Int32, Boolean, Boolean) |