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.
Note
This API is experimental and might change in incompatible ways in the next release.
Implements
Inherited Members
Namespace: Lucene.Net.Search.Suggest.Analyzing
Assembly: Lucene.Net.Suggest.dll
Syntax
public class BlendedInfixSuggester : AnalyzingInfixSuggester, IDisposable
Constructors
| Improve this Doc View SourceBlendedInfixSuggester(LuceneVersion, Directory, Analyzer)
Create a new instance, loading from a previously built directory, if it exists.
Declaration
public BlendedInfixSuggester(LuceneVersion matchVersion, Directory dir, Analyzer analyzer)
Parameters
| Type | Name | Description |
|---|---|---|
| Lucene.Net.Util.LuceneVersion | matchVersion | |
| Lucene.Net.Store.Directory | dir | |
| Lucene.Net.Analysis.Analyzer | analyzer |
BlendedInfixSuggester(LuceneVersion, Directory, Analyzer, Analyzer, Int32, BlendedInfixSuggester.BlenderType, Int32)
Create a new instance, loading from a previously built directory, if it exists.
Declaration
public BlendedInfixSuggester(LuceneVersion matchVersion, Directory dir, Analyzer indexAnalyzer, Analyzer queryAnalyzer, int minPrefixChars, BlendedInfixSuggester.BlenderType blenderType, int numFactor)
Parameters
| Type | Name | Description |
|---|---|---|
| Lucene.Net.Util.LuceneVersion | matchVersion | |
| Lucene.Net.Store.Directory | dir | |
| Lucene.Net.Analysis.Analyzer | indexAnalyzer | |
| Lucene.Net.Analysis.Analyzer | queryAnalyzer | |
| System.Int32 | minPrefixChars | |
| BlendedInfixSuggester.BlenderType | blenderType | Type of blending strategy, see BlenderType for more precisions |
| System.Int32 | numFactor | Factor to multiply the number of searched elements before ponderate |
Exceptions
| Type | Condition |
|---|---|
| System.IO.IOException | If there are problems opening the underlying Lucene index. |
BlendedInfixSuggester(LuceneVersion, Directory, Analyzer, Analyzer, Int32, BlendedInfixSuggester.BlenderType, Int32, Boolean)
Create a new instance, loading from a previously built directory, if it exists.
Declaration
public BlendedInfixSuggester(LuceneVersion matchVersion, Directory dir, Analyzer indexAnalyzer, Analyzer queryAnalyzer, int minPrefixChars, BlendedInfixSuggester.BlenderType blenderType, int numFactor, bool commitOnBuild)
Parameters
| Type | Name | Description |
|---|---|---|
| Lucene.Net.Util.LuceneVersion | matchVersion | |
| Lucene.Net.Store.Directory | dir | |
| Lucene.Net.Analysis.Analyzer | indexAnalyzer | |
| Lucene.Net.Analysis.Analyzer | queryAnalyzer | |
| System.Int32 | minPrefixChars | |
| BlendedInfixSuggester.BlenderType | blenderType | Type of blending strategy, see BlenderType for more precisions |
| System.Int32 | numFactor | Factor to multiply the number of searched elements before ponderate |
| System.Boolean | commitOnBuild | Call commit after the index has finished building. This would persist the suggester index to disk and future instances of this suggester can use this pre-built dictionary. |
Exceptions
| Type | Condition |
|---|---|
| System.IO.IOException | If there are problems opening the underlying Lucene index. |
Fields
| Improve this Doc View SourceDEFAULT_NUM_FACTOR
Default factor
Declaration
public static int DEFAULT_NUM_FACTOR
Field Value
| Type | Description |
|---|---|
| System.Int32 |
LINEAR_COEF
Coefficient used for linear blending
Declaration
protected static double LINEAR_COEF
Field Value
| Type | Description |
|---|---|
| System.Double |
Methods
| Improve this Doc View SourceCalculateCoefficient(Int32)
Calculate the weight coefficient based on the position of the first matching word. Subclass should override it to adapt it to particular needs
Declaration
protected virtual double CalculateCoefficient(int position)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | position | of the first matching word in text |
Returns
| Type | Description |
|---|---|
| System.Double | the coefficient |
CreateResults(IndexSearcher, TopFieldDocs, Int32, String, Boolean, ICollection<String>, String)
Declaration
protected override IList<Lookup.LookupResult> CreateResults(IndexSearcher searcher, TopFieldDocs hits, int num, string key, bool doHighlight, ICollection<string> matchedTokens, string prefixToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Lucene.Net.Search.IndexSearcher | searcher | |
| Lucene.Net.Search.TopFieldDocs | hits | |
| System.Int32 | num | |
| System.String | key | |
| System.Boolean | doHighlight | |
| System.Collections.Generic.ICollection<System.String> | matchedTokens | |
| System.String | prefixToken |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IList<Lookup.LookupResult> |
Overrides
| Improve this Doc View SourceDoLookup(String, IEnumerable<BytesRef>, Boolean, Int32)
Declaration
public override IList<Lookup.LookupResult> DoLookup(string key, IEnumerable<BytesRef> contexts, bool onlyMorePopular, int num)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | |
| System.Collections.Generic.IEnumerable<Lucene.Net.Util.BytesRef> | contexts | |
| System.Boolean | onlyMorePopular | |
| System.Int32 | num |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IList<Lookup.LookupResult> |
Overrides
| Improve this Doc View SourceDoLookup(String, IEnumerable<BytesRef>, Int32, Boolean, Boolean)
Declaration
public override IList<Lookup.LookupResult> DoLookup(string key, IEnumerable<BytesRef> contexts, int num, bool allTermsRequired, bool doHighlight)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | |
| System.Collections.Generic.IEnumerable<Lucene.Net.Util.BytesRef> | contexts | |
| System.Int32 | num | |
| System.Boolean | allTermsRequired | |
| System.Boolean | doHighlight |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IList<Lookup.LookupResult> |
Overrides
| Improve this Doc View SourceGetTextFieldType()
Declaration
protected override FieldType GetTextFieldType()
Returns
| Type | Description |
|---|---|
| Lucene.Net.Documents.FieldType |