Table of Contents

Class NpgsqlTrigramsDbFunctionsExtensions

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 NpgsqlTrigramsDbFunctionsExtensions
Inheritance
NpgsqlTrigramsDbFunctionsExtensions
Inherited Members

Remarks

Methods

TrigramsAreNotStrictWordSimilar(DbFunctions, string, string)

Commutator of the <<% operator.

public static bool TrigramsAreNotStrictWordSimilar(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

bool

Remarks

The method call is translated to source %>> target. See https://www.postgresql.org/docs/current/pgtrgm.html.

TrigramsAreNotWordSimilar(DbFunctions, string, string)

Commutator of the <% operator.

public static bool TrigramsAreNotWordSimilar(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

bool

Remarks

The method call is translated to source %> target. See https://www.postgresql.org/docs/current/pgtrgm.html.

TrigramsAreSimilar(DbFunctions, string, string)

Returns true if its arguments have a similarity that is greater than the current similarity threshold set by pg_trgm.similarity_threshold.

public static bool TrigramsAreSimilar(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

bool

Remarks

The method call is translated to source % target. See https://www.postgresql.org/docs/current/pgtrgm.html.

TrigramsAreStrictWordSimilar(DbFunctions, string, string)

Returns true if its second argument has a continuous extent of an ordered trigram set that matches word boundaries, and its similarity to the trigram set of the first argument is greater than the current strict word similarity threshold set by the pg_trgm.strict_word_similarity_threshold parameter.

public static bool TrigramsAreStrictWordSimilar(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

bool

Remarks

The method call is translated to source <<% target. See https://www.postgresql.org/docs/current/pgtrgm.html.

TrigramsAreWordSimilar(DbFunctions, string, string)

Returns true if the similarity between the trigram set in the first argument and a continuous extent of an ordered trigram set in the second argument is greater than the current word similarity threshold set by pg_trgm.word_similarity_threshold parameter.

public static bool TrigramsAreWordSimilar(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

bool

Remarks

The method call is translated to source <% target. See https://www.postgresql.org/docs/current/pgtrgm.html.

TrigramsShow(DbFunctions, string)

Returns an array of all the trigrams in the given text. (In practice this is seldom useful except for debugging.)

public static string[] TrigramsShow(this DbFunctions _, string text)

Parameters

_ DbFunctions
text string

Returns

string[]

Remarks

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

TrigramsSimilarity(DbFunctions, string, string)

Returns a number that indicates how similar the two arguments are. The range of the result is zero (indicating that the two strings are completely dissimilar) to one (indicating that the two strings are identical).

public static double TrigramsSimilarity(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

double

Remarks

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

TrigramsSimilarityDistance(DbFunctions, string, string)

Returns the "distance" between the arguments, that is one minus the similarity() value.

public static double TrigramsSimilarityDistance(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

double

Remarks

The method call is translated to source <-> target. See https://www.postgresql.org/docs/current/pgtrgm.html.

TrigramsStrictWordSimilarity(DbFunctions, string, string)

Same as word_similarity(text, text), but forces extent boundaries to match word boundaries. Since we don't have cross-word trigrams, this function actually returns greatest similarity between first string and any continuous extent of words of the second string.

public static double TrigramsStrictWordSimilarity(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

double

Remarks

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

TrigramsStrictWordSimilarityDistance(DbFunctions, string, string)

Returns the "distance" between the arguments, that is one minus the strict_word_similarity() value.

public static double TrigramsStrictWordSimilarityDistance(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

double

Remarks

The method call is translated to source <<<-> target. See https://www.postgresql.org/docs/current/pgtrgm.html.

TrigramsStrictWordSimilarityDistanceInverted(DbFunctions, string, string)

Commutator of the <<<-> operator.

public static double TrigramsStrictWordSimilarityDistanceInverted(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

double

Remarks

The method call is translated to source <->>> target. See https://www.postgresql.org/docs/current/pgtrgm.html.

TrigramsWordSimilarity(DbFunctions, string, string)

Returns a number that indicates the greatest similarity between the set of trigrams in the first string and any continuous extent of an ordered set of trigrams in the second string.

public static double TrigramsWordSimilarity(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

double

Remarks

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

TrigramsWordSimilarityDistance(DbFunctions, string, string)

Returns the "distance" between the arguments, that is one minus the word_similarity() value.

public static double TrigramsWordSimilarityDistance(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

double

Remarks

The method call is translated to source <<-> target. See https://www.postgresql.org/docs/current/pgtrgm.html.

TrigramsWordSimilarityDistanceInverted(DbFunctions, string, string)

Commutator of the <<-> operator.

public static double TrigramsWordSimilarityDistanceInverted(this DbFunctions _, string source, string target)

Parameters

_ DbFunctions
source string
target string

Returns

double

Remarks

The method call is translated to source <->> target. See https://www.postgresql.org/docs/current/pgtrgm.html.