Class NpgsqlFuzzyStringMatchDbFunctionsExtensions
Provides CLR methods that get translated to database functions when used in LINQ to Entities queries.
The methods on this class are accessed via
Namespace: Microsoft.EntityFrameworkCore
Assembly: Npgsql.EntityFrameworkCore.PostgreSQL.dll
Syntax
public static class NpgsqlFuzzyStringMatchDbFunctionsExtensions
Remarks
See Database functions.
Methods
| Improve this Doc View SourceFuzzyStringMatchDifference(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.
Declaration
public static int FuzzyStringMatchDifference(this DbFunctions _, string source, string target)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
string | source | |
string | target |
Returns
Type | Description |
---|---|
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.
Declaration
public static string FuzzyStringMatchDoubleMetaphone(this DbFunctions _, string text)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
string | text |
Returns
Type | Description |
---|---|
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.
Declaration
public static string FuzzyStringMatchDoubleMetaphoneAlt(this DbFunctions _, string text)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
string | text |
Returns
Type | Description |
---|---|
string |
Remarks
The method call is translated to dmetaphone_alt(text)
.
See https://www.postgresql.org/docs/current/fuzzystrmatch.html.
FuzzyStringMatchLevenshtein(DbFunctions, string, string, int, int, int)
Returns the Levenshtein distance between two strings.
Declaration
public static int FuzzyStringMatchLevenshtein(this DbFunctions _, string source, string target, int insertionCost, int deletionCost, int substitutionCost)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
string | source | |
string | target | |
int | insertionCost | |
int | deletionCost | |
int | substitutionCost |
Returns
Type | Description |
---|---|
int |
Remarks
The method call is translated to levenshtein(source, target, insertionCost, deletionCost, substitutionCost)
.
See https://www.postgresql.org/docs/current/fuzzystrmatch.html.
FuzzyStringMatchLevenshtein(DbFunctions, string, string)
Returns the Levenshtein distance between two strings.
Declaration
public static int FuzzyStringMatchLevenshtein(this DbFunctions _, string source, string target)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
string | source | |
string | target |
Returns
Type | Description |
---|---|
int |
Remarks
The method call is translated to levenshtein(source, target)
.
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.
Declaration
public static int FuzzyStringMatchLevenshteinLessEqual(this DbFunctions _, string source, string target, int insertionCost, int deletionCost, int substitutionCost, int maximumDistance)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
string | source | |
string | target | |
int | insertionCost | |
int | deletionCost | |
int | substitutionCost | |
int | maximumDistance |
Returns
Type | Description |
---|---|
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.
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.
Declaration
public static int FuzzyStringMatchLevenshteinLessEqual(this DbFunctions _, string source, string target, int maximumDistance)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
string | source | |
string | target | |
int | maximumDistance |
Returns
Type | Description |
---|---|
int |
Remarks
The method call is translated to levenshtein_less_equal(source, target, maximumDistance)
.
See https://www.postgresql.org/docs/current/fuzzystrmatch.html.
FuzzyStringMatchMetaphone(DbFunctions, string, int)
The metaphone function converts a string to its Metaphone code.
Declaration
public static string FuzzyStringMatchMetaphone(this DbFunctions _, string text, int maximumOutputLength)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
string | text | |
int | maximumOutputLength |
Returns
Type | Description |
---|---|
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.
Declaration
public static string FuzzyStringMatchSoundex(this DbFunctions _, string text)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
string | text |
Returns
Type | Description |
---|---|
string |
Remarks
The method call is translated to soundex(text)
.
See https://www.postgresql.org/docs/current/fuzzystrmatch.html.