C# Класс Lucene.Net.Search.Suggest.Analyzing.FuzzySuggester

Implements a fuzzy AnalyzingSuggester. The similarity measurement is based on the Damerau-Levenshtein (optimal string alignment) algorithm, though you can explicitly choose classic Levenshtein by passing false for the transpositions parameter.

At most, this query will match terms up to {@value org.apache.lucene.util.automaton.LevenshteinAutomata#MAXIMUM_SUPPORTED_DISTANCE} edits. Higher distances are not supported. Note that the fuzzy distance is measured in "byte space" on the bytes returned by the TokenStream's {@link TermToBytesRefAttribute}, usually UTF8. By default the analyzed bytes must be at least 3 {@link #DEFAULT_MIN_FUZZY_LENGTH} bytes before any edits are considered. Furthermore, the first 1 {@link #DEFAULT_NON_FUZZY_PREFIX} byte is not allowed to be edited. We allow up to 1 (@link #DEFAULT_MAX_EDITS} edit. If #unicodeAware parameter in the constructor is set to true, maxEdits, minFuzzyLength, transpositions and nonFuzzyPrefix are measured in Unicode code points (actual letters) instead of bytes.

NOTE: This suggester does not boost suggestions that required no edits over suggestions that did require edits. This is a known limitation.

Note: complex query analyzers can have a significant impact on the lookup performance. It's recommended to not use analyzers that drop or inject terms like synonyms to keep the complexity of the prefix intersection low for good lookup performance. At index time, complex analyzers can safely be used.

@lucene.experimental
Наследование: AnalyzingSuggester
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
ToLevenshteinAutomata Lucene.Net.Util.Automaton.Automaton

Открытые методы

Метод Описание
FuzzySuggester ( Analyzer analyzer ) : Lucene.Net.Analysis

Creates a FuzzySuggester instance initialized with default values.

FuzzySuggester ( Analyzer indexAnalyzer, Analyzer queryAnalyzer ) : Lucene.Net.Analysis

Creates a FuzzySuggester instance with an index & a query analyzer initialized with default values.

FuzzySuggester ( Analyzer indexAnalyzer, Analyzer queryAnalyzer, SuggesterOptions options, int maxSurfaceFormsPerAnalyzedForm, int maxGraphExpansions, bool preservePositionIncrements, int maxEdits, bool transpositions, int nonFuzzyPrefix, int minFuzzyLength, bool unicodeAware ) : Lucene.Net.Analysis

Creates a FuzzySuggester instance.

Защищенные методы

Метод Описание
ConvertAutomaton ( Automaton a ) : Automaton
GetFullPrefixPaths ( BytesRef>.List prefixPaths, Automaton lookupAutomaton, BytesRef>.FST fst ) : BytesRef>.Pair>>.List

Приватные методы

Метод Описание
ToLevenshteinAutomata ( Automaton automaton ) : Automaton

Описание методов

ConvertAutomaton() защищенный Метод

protected ConvertAutomaton ( Automaton a ) : Automaton
a Lucene.Net.Util.Automaton.Automaton
Результат Lucene.Net.Util.Automaton.Automaton

FuzzySuggester() публичный Метод

Creates a FuzzySuggester instance initialized with default values.
public FuzzySuggester ( Analyzer analyzer ) : Lucene.Net.Analysis
analyzer Lucene.Net.Analysis.Analyzer The used for this suggester.
Результат Lucene.Net.Analysis

FuzzySuggester() публичный Метод

Creates a FuzzySuggester instance with an index & a query analyzer initialized with default values.
public FuzzySuggester ( Analyzer indexAnalyzer, Analyzer queryAnalyzer ) : Lucene.Net.Analysis
indexAnalyzer Lucene.Net.Analysis.Analyzer /// that will be used for analyzing suggestions while building the index.
queryAnalyzer Lucene.Net.Analysis.Analyzer /// that will be used for analyzing query text during lookup
Результат Lucene.Net.Analysis

FuzzySuggester() публичный Метод

Creates a FuzzySuggester instance.
public FuzzySuggester ( Analyzer indexAnalyzer, Analyzer queryAnalyzer, SuggesterOptions options, int maxSurfaceFormsPerAnalyzedForm, int maxGraphExpansions, bool preservePositionIncrements, int maxEdits, bool transpositions, int nonFuzzyPrefix, int minFuzzyLength, bool unicodeAware ) : Lucene.Net.Analysis
indexAnalyzer Lucene.Net.Analysis.Analyzer The that will be used for /// analyzing suggestions while building the index.
queryAnalyzer Lucene.Net.Analysis.Analyzer The that will be used for /// analyzing query text during lookup
options SuggesterOptions see ,
maxSurfaceFormsPerAnalyzedForm int Maximum number of /// surface forms to keep for a single analyzed form. /// When there are too many surface forms we discard the /// lowest weighted ones.
maxGraphExpansions int Maximum number of graph paths /// to expand from the analyzed form. Set this to -1 for /// no limit.
preservePositionIncrements bool Whether position holes should appear in the automaton
maxEdits int must be >= 0 and <= .
transpositions bool true if transpositions should be treated as a primitive /// edit operation. If this is false, comparisons will implement the classic /// Levenshtein algorithm.
nonFuzzyPrefix int length of common (non-fuzzy) prefix (see default
minFuzzyLength int minimum length of lookup key before any edits are allowed (see default )
unicodeAware bool operate Unicode code points instead of bytes.
Результат Lucene.Net.Analysis

GetFullPrefixPaths() защищенный Метод

protected GetFullPrefixPaths ( BytesRef>.List prefixPaths, Automaton lookupAutomaton, BytesRef>.FST fst ) : BytesRef>.Pair>>.List
prefixPaths BytesRef>.List
lookupAutomaton Lucene.Net.Util.Automaton.Automaton
fst BytesRef>.FST
Результат BytesRef>.Pair>>.List