Table of Contents

Class NpgsqlFuzzyStringMatchDbFunctionsExtensions

Namespace
Microsoft.EntityFrameworkCore
Assembly
Npgsql.EntityFrameworkCore.PostgreSQL.dll

Provides CLR methods that get translated to database functions when used in LINQ to Entities queries. The methods on this class are accessed via Functions.

public static class NpgsqlFuzzyStringMatchDbFunctionsExtensions
Inheritance
NpgsqlFuzzyStringMatchDbFunctionsExtensions
Inherited Members

Remarks

Methods

FuzzyStringMatchDifference(DbFunctions, string, string)

The difference function converts two strings to their Soundex codes and then returns the number of matching code positions. Since Soundex codes have four characters, the result ranges from zero to four, with zero being no match and four being an exact match.

public static int FuzzyStringMatchDifference(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

int

Remarks

The method call is translated to difference(source, target). See https://www.postgresql.org/docs/current/fuzzystrmatch.html.

FuzzyStringMatchDoubleMetaphone(DbFunctions, string)

The dmetaphone function converts a string to its primary Double Metaphone code.

public static string FuzzyStringMatchDoubleMetaphone(this DbFunctions _, string text)

Parameters

_ DbFunctions
text string

Returns

string

Remarks

The method call is translated to dmetaphone(text). See https://www.postgresql.org/docs/current/fuzzystrmatch.html.

FuzzyStringMatchDoubleMetaphoneAlt(DbFunctions, string)

The dmetaphone_alt function converts a string to its alternate Double Metaphone code.

public static string FuzzyStringMatchDoubleMetaphoneAlt(this DbFunctions _, string text)

Parameters

_ DbFunctions
text string

Returns

string

Remarks

The method call is translated to dmetaphone_alt(text). See https://www.postgresql.org/docs/current/fuzzystrmatch.html.

FuzzyStringMatchLevenshtein(DbFunctions, string, string)

Returns the Levenshtein distance between two strings.

public static int FuzzyStringMatchLevenshtein(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

int

Remarks

The method call is translated to levenshtein(source, target). See https://www.postgresql.org/docs/current/fuzzystrmatch.html.

FuzzyStringMatchLevenshtein(DbFunctions, string, string, int, int, int)

Returns the Levenshtein distance between two strings.

public static int FuzzyStringMatchLevenshtein(this DbFunctions _, string source, string target, int insertionCost, int deletionCost, int substitutionCost)

Parameters

_ DbFunctions
source string
target string
insertionCost int
deletionCost int
substitutionCost int

Returns

int

Remarks

The method call is translated to levenshtein(source, target, insertionCost, deletionCost, substitutionCost). See https://www.postgresql.org/docs/current/fuzzystrmatch.html.

FuzzyStringMatchLevenshteinLessEqual(DbFunctions, string, string, int)

levenshtein_less_equal is an accelerated version of the Levenshtein function for use when only small distances are of interest. If the actual distance is less than or equal to maximum distance, then levenshtein_less_equal returns the correct distance; otherwise it returns some value greater than maximum distance. If maximum distance is negative then the behavior is the same as levenshtein.

public static int FuzzyStringMatchLevenshteinLessEqual(this DbFunctions _, string source, string target, int maximumDistance)

Parameters

_ DbFunctions
source string
target string
maximumDistance int

Returns

int

Remarks

The method call is translated to levenshtein_less_equal(source, target, maximumDistance). See https://www.postgresql.org/docs/current/fuzzystrmatch.html.

FuzzyStringMatchLevenshteinLessEqual(DbFunctions, string, string, int, int, int, int)

levenshtein_less_equal is an accelerated version of the Levenshtein function for use when only small distances are of interest. If the actual distance is less than or equal to maximum distance, then levenshtein_less_equal returns the correct distance; otherwise it returns some value greater than maximum distance. If maximum distance is negative then the behavior is the same as levenshtein.

public static int FuzzyStringMatchLevenshteinLessEqual(this DbFunctions _, string source, string target, int insertionCost, int deletionCost, int substitutionCost, int maximumDistance)

Parameters

_ DbFunctions
source string
target string
insertionCost int
deletionCost int
substitutionCost int
maximumDistance int

Returns

int

Remarks

The method call is translated to levenshtein_less_equal(source, target, insertionCost, deletionCost, substitutionCost, maximumDistance). See https://www.postgresql.org/docs/current/fuzzystrmatch.html.

FuzzyStringMatchMetaphone(DbFunctions, string, int)

The metaphone function converts a string to its Metaphone code.

public static string FuzzyStringMatchMetaphone(this DbFunctions _, string text, int maximumOutputLength)

Parameters

_ DbFunctions
text string
maximumOutputLength int

Returns

string

Remarks

The method call is translated to metaphone(text, maximumOutputLength). See https://www.postgresql.org/docs/current/fuzzystrmatch.html.

FuzzyStringMatchSoundex(DbFunctions, string)

The soundex function converts a string to its Soundex code.

public static string FuzzyStringMatchSoundex(this DbFunctions _, string text)

Parameters

_ DbFunctions
text string

Returns

string

Remarks

The method call is translated to soundex(text). See https://www.postgresql.org/docs/current/fuzzystrmatch.html.