Table of Contents

Class NpgsqlFullTextSearchLinqExtensions

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

Provides EF Core extension methods for Npgsql full-text search types.

public static class NpgsqlFullTextSearchLinqExtensions
Inheritance
NpgsqlFullTextSearchLinqExtensions
Inherited Members

Methods

And(NpgsqlTsQuery, NpgsqlTsQuery)

public static NpgsqlTsQuery And(this NpgsqlTsQuery query1, NpgsqlTsQuery query2)

Parameters

query1 NpgsqlTsQuery
query2 NpgsqlTsQuery

Returns

NpgsqlTsQuery

Concat(NpgsqlTsVector, NpgsqlTsVector)

Returns a vector which combines the lexemes and positional information of vector1 and vector2 using the || tsvector operator. Positions and weight labels are retained during the concatenation. https://www.postgresql.org/docs/10/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSVECTOR

public static NpgsqlTsVector Concat(this NpgsqlTsVector vector1, NpgsqlTsVector vector2)

Parameters

vector1 NpgsqlTsVector
vector2 NpgsqlTsVector

Returns

NpgsqlTsVector

Contains(NpgsqlTsQuery, NpgsqlTsQuery)

Returns whether query1 contains query2. Generates the "@>" operator. http://www.postgresql.org/docs/current/static/functions-textsearch.html

public static bool Contains(this NpgsqlTsQuery query1, NpgsqlTsQuery query2)

Parameters

query1 NpgsqlTsQuery
query2 NpgsqlTsQuery

Returns

bool

Delete(NpgsqlTsVector, string)

Return a new vector with lexeme removed from vector https://www.postgresql.org/docs/current/static/functions-textsearch.html

public static NpgsqlTsVector Delete(this NpgsqlTsVector vector, string lexeme)

Parameters

vector NpgsqlTsVector
lexeme string

Returns

NpgsqlTsVector

Delete(NpgsqlTsVector, string[])

Return a new vector with lexemes removed from vector https://www.postgresql.org/docs/current/static/functions-textsearch.html

public static NpgsqlTsVector Delete(this NpgsqlTsVector vector, string[] lexemes)

Parameters

vector NpgsqlTsVector
lexemes string[]

Returns

NpgsqlTsVector

Filter(NpgsqlTsVector, char[])

Returns a new vector with only lexemes having weights specified in weights. https://www.postgresql.org/docs/current/static/functions-textsearch.html

public static NpgsqlTsVector Filter(this NpgsqlTsVector vector, char[] weights)

Parameters

vector NpgsqlTsVector
weights char[]

Returns

NpgsqlTsVector

GetLength(NpgsqlTsVector)

public static int GetLength(this NpgsqlTsVector vector)

Parameters

vector NpgsqlTsVector

Returns

int

GetNodeCount(NpgsqlTsQuery)

public static int GetNodeCount(this NpgsqlTsQuery query)

Parameters

query NpgsqlTsQuery

Returns

int

GetQueryTree(NpgsqlTsQuery)

public static string GetQueryTree(this NpgsqlTsQuery query)

Parameters

query NpgsqlTsQuery

Returns

string

GetResultHeadline(NpgsqlTsQuery, string)

Returns a string suitable for display containing a query match. http://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-HEADLINE

public static string GetResultHeadline(this NpgsqlTsQuery query, string document)

Parameters

query NpgsqlTsQuery
document string

Returns

string

GetResultHeadline(NpgsqlTsQuery, string, string)

Returns a string suitable for display containing a query match. http://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-HEADLINE

public static string GetResultHeadline(this NpgsqlTsQuery query, string document, string options)

Parameters

query NpgsqlTsQuery
document string
options string

Returns

string

GetResultHeadline(NpgsqlTsQuery, string, string, string)

Returns a string suitable for display containing a query match using the text search configuration specified by config. http://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-HEADLINE

public static string GetResultHeadline(this NpgsqlTsQuery query, string config, string document, string options)

Parameters

query NpgsqlTsQuery
config string
document string
options string

Returns

string

IsContainedIn(NpgsqlTsQuery, NpgsqlTsQuery)

Returns whether query1 is contained within query2. Generates the "<@" operator. http://www.postgresql.org/docs/current/static/functions-textsearch.html

public static bool IsContainedIn(this NpgsqlTsQuery query1, NpgsqlTsQuery query2)

Parameters

query1 NpgsqlTsQuery
query2 NpgsqlTsQuery

Returns

bool

Matches(NpgsqlTsVector, NpgsqlTsQuery)

public static bool Matches(this NpgsqlTsVector vector, NpgsqlTsQuery query)

Parameters

vector NpgsqlTsVector
query NpgsqlTsQuery

Returns

bool

Matches(NpgsqlTsVector, string)

This method generates the "@@" match operator. The <code class="paramref">query parameter is assumed to be a plain search query and will be converted to a tsquery using plainto_tsquery. http://www.postgresql.org/docs/current/static/textsearch-intro.html#TEXTSEARCH-MATCHING

public static bool Matches(this NpgsqlTsVector vector, string query)

Parameters

vector NpgsqlTsVector
query string

Returns

bool

Or(NpgsqlTsQuery, NpgsqlTsQuery)

public static NpgsqlTsQuery Or(this NpgsqlTsQuery query1, NpgsqlTsQuery query2)

Parameters

query1 NpgsqlTsQuery
query2 NpgsqlTsQuery

Returns

NpgsqlTsQuery

Rank(NpgsqlTsVector, NpgsqlTsQuery)

public static float Rank(this NpgsqlTsVector vector, NpgsqlTsQuery query)

Parameters

vector NpgsqlTsVector
query NpgsqlTsQuery

Returns

float

Rank(NpgsqlTsVector, NpgsqlTsQuery, NpgsqlTsRankingNormalization)

Calculates the rank of vector for query while normalizing the result according to the behaviors specified by normalization. http://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-RANKING

public static float Rank(this NpgsqlTsVector vector, NpgsqlTsQuery query, NpgsqlTsRankingNormalization normalization)

Parameters

vector NpgsqlTsVector
query NpgsqlTsQuery
normalization NpgsqlTsRankingNormalization

Returns

float

Rank(NpgsqlTsVector, float[], NpgsqlTsQuery)

Calculates the rank of vector for query with custom weighting for word instances depending on their labels (D, C, B or A). http://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-RANKING

public static float Rank(this NpgsqlTsVector vector, float[] weights, NpgsqlTsQuery query)

Parameters

vector NpgsqlTsVector
weights float[]
query NpgsqlTsQuery

Returns

float

Rank(NpgsqlTsVector, float[], NpgsqlTsQuery, NpgsqlTsRankingNormalization)

Calculates the rank of vector for query while normalizing the result according to the behaviors specified by normalization and using custom weighting for word instances depending on their labels (D, C, B or A). http://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-RANKING

public static float Rank(this NpgsqlTsVector vector, float[] weights, NpgsqlTsQuery query, NpgsqlTsRankingNormalization normalization)

Parameters

vector NpgsqlTsVector
weights float[]
query NpgsqlTsQuery
normalization NpgsqlTsRankingNormalization

Returns

float

RankCoverDensity(NpgsqlTsVector, NpgsqlTsQuery)

Calculates the rank of vector for query using the cover density method. http://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-RANKING

public static float RankCoverDensity(this NpgsqlTsVector vector, NpgsqlTsQuery query)

Parameters

vector NpgsqlTsVector
query NpgsqlTsQuery

Returns

float

RankCoverDensity(NpgsqlTsVector, NpgsqlTsQuery, NpgsqlTsRankingNormalization)

Calculates the rank of vector for query using the cover density method while normalizing the result according to the behaviors specified by normalization. http://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-RANKING

public static float RankCoverDensity(this NpgsqlTsVector vector, NpgsqlTsQuery query, NpgsqlTsRankingNormalization normalization)

Parameters

vector NpgsqlTsVector
query NpgsqlTsQuery
normalization NpgsqlTsRankingNormalization

Returns

float

RankCoverDensity(NpgsqlTsVector, float[], NpgsqlTsQuery)

Calculates the rank of vector for query using the cover density method with custom weighting for word instances depending on their labels (D, C, B or A). http://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-RANKING

public static float RankCoverDensity(this NpgsqlTsVector vector, float[] weights, NpgsqlTsQuery query)

Parameters

vector NpgsqlTsVector
weights float[]
query NpgsqlTsQuery

Returns

float

RankCoverDensity(NpgsqlTsVector, float[], NpgsqlTsQuery, NpgsqlTsRankingNormalization)

Calculates the rank of vector for query using the cover density method while normalizing the result according to the behaviors specified by normalization and using custom weighting for word instances depending on their labels (D, C, B or A). http://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-RANKING

public static float RankCoverDensity(this NpgsqlTsVector vector, float[] weights, NpgsqlTsQuery query, NpgsqlTsRankingNormalization normalization)

Parameters

vector NpgsqlTsVector
weights float[]
query NpgsqlTsQuery
normalization NpgsqlTsRankingNormalization

Returns

float

Rewrite(NpgsqlTsQuery, NpgsqlTsQuery, NpgsqlTsQuery)

Searches query for occurrences of target, and replaces each occurrence with a substitute. All parameters are of type tsquery. http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSQUERY

public static NpgsqlTsQuery Rewrite(this NpgsqlTsQuery query, NpgsqlTsQuery target, NpgsqlTsQuery substitute)

Parameters

query NpgsqlTsQuery
target NpgsqlTsQuery
substitute NpgsqlTsQuery

Returns

NpgsqlTsQuery

Rewrite(NpgsqlTsQuery, string)

For each row of the SQL select result, occurrences of the first column value (the target) are replaced by the second column value (the substitute) within the current query value. The select must yield two columns of tsquery type. http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSQUERY

public static NpgsqlTsQuery Rewrite(this NpgsqlTsQuery query, string select)

Parameters

query NpgsqlTsQuery
select string

Returns

NpgsqlTsQuery

SetWeight(NpgsqlTsVector, Weight)

Assign weight to each element of vector and return a new weighted tsvector. http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSVECTOR

public static NpgsqlTsVector SetWeight(this NpgsqlTsVector vector, NpgsqlTsVector.Lexeme.Weight weight)

Parameters

vector NpgsqlTsVector
weight NpgsqlTsVector.Lexeme.Weight

Returns

NpgsqlTsVector

SetWeight(NpgsqlTsVector, Weight, string[])

Assign weight to elements of vector that are in lexemes and return a new weighted tsvector. http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSVECTOR

public static NpgsqlTsVector SetWeight(this NpgsqlTsVector vector, NpgsqlTsVector.Lexeme.Weight weight, string[] lexemes)

Parameters

vector NpgsqlTsVector
weight NpgsqlTsVector.Lexeme.Weight
lexemes string[]

Returns

NpgsqlTsVector

SetWeight(NpgsqlTsVector, char)

Assign weight to each element of vector and return a new weighted tsvector. http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSVECTOR

public static NpgsqlTsVector SetWeight(this NpgsqlTsVector vector, char weight)

Parameters

vector NpgsqlTsVector
weight char

Returns

NpgsqlTsVector

SetWeight(NpgsqlTsVector, char, string[])

Assign weight to elements of vector that are in lexemes and return a new weighted tsvector. http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSVECTOR

public static NpgsqlTsVector SetWeight(this NpgsqlTsVector vector, char weight, string[] lexemes)

Parameters

vector NpgsqlTsVector
weight char
lexemes string[]

Returns

NpgsqlTsVector

ToNegative(NpgsqlTsQuery)

public static NpgsqlTsQuery ToNegative(this NpgsqlTsQuery query)

Parameters

query NpgsqlTsQuery

Returns

NpgsqlTsQuery

ToPhrase(NpgsqlTsQuery, NpgsqlTsQuery)

Returns a tsquery that searches for a match to query1 followed by a match to query2. http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSQUERY

public static NpgsqlTsQuery ToPhrase(this NpgsqlTsQuery query1, NpgsqlTsQuery query2)

Parameters

query1 NpgsqlTsQuery
query2 NpgsqlTsQuery

Returns

NpgsqlTsQuery

ToPhrase(NpgsqlTsQuery, NpgsqlTsQuery, int)

Returns a tsquery that searches for a match to query1 followed by a match to query2 at a distance of distance lexemes using the <N> tsquery operator http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSQUERY

public static NpgsqlTsQuery ToPhrase(this NpgsqlTsQuery query1, NpgsqlTsQuery query2, int distance)

Parameters

query1 NpgsqlTsQuery
query2 NpgsqlTsQuery
distance int

Returns

NpgsqlTsQuery

ToStripped(NpgsqlTsVector)

Removes weights and positions from vector and returns a new stripped tsvector. http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSVECTOR

public static NpgsqlTsVector ToStripped(this NpgsqlTsVector vector)

Parameters

vector NpgsqlTsVector

Returns

NpgsqlTsVector