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)
AND tsquerys together. Generates the "&&" operator. http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSQUERY
public static NpgsqlTsQuery And(this NpgsqlTsQuery query1, NpgsqlTsQuery query2)
Parameters
query1
NpgsqlTsQueryquery2
NpgsqlTsQuery
Returns
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
NpgsqlTsVectorvector2
NpgsqlTsVector
Returns
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
NpgsqlTsQueryquery2
NpgsqlTsQuery
Returns
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
NpgsqlTsVectorlexeme
string
Returns
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
NpgsqlTsVectorlexemes
string[]
Returns
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
NpgsqlTsVectorweights
char[]
Returns
GetLength(NpgsqlTsVector)
Returns the number of lexemes in vector
.
http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSVECTOR
public static int GetLength(this NpgsqlTsVector vector)
Parameters
vector
NpgsqlTsVector
Returns
GetNodeCount(NpgsqlTsQuery)
Returns the number of lexemes plus operators in query
.
http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSQUERY
public static int GetNodeCount(this NpgsqlTsQuery query)
Parameters
query
NpgsqlTsQuery
Returns
GetQueryTree(NpgsqlTsQuery)
Get the indexable part of query
.
http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSQUERY
public static string GetQueryTree(this NpgsqlTsQuery query)
Parameters
query
NpgsqlTsQuery
Returns
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
NpgsqlTsQuerydocument
string
Returns
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
NpgsqlTsQuerydocument
stringoptions
string
Returns
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
NpgsqlTsQueryconfig
stringdocument
stringoptions
string
Returns
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
NpgsqlTsQueryquery2
NpgsqlTsQuery
Returns
Matches(NpgsqlTsVector, NpgsqlTsQuery)
This method generates the "@@" match operator. http://www.postgresql.org/docs/current/static/textsearch-intro.html#TEXTSEARCH-MATCHING
public static bool Matches(this NpgsqlTsVector vector, NpgsqlTsQuery query)
Parameters
vector
NpgsqlTsVectorquery
NpgsqlTsQuery
Returns
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
NpgsqlTsVectorquery
string
Returns
Or(NpgsqlTsQuery, NpgsqlTsQuery)
OR tsquerys together. Generates the "||" operator. http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSQUERY
public static NpgsqlTsQuery Or(this NpgsqlTsQuery query1, NpgsqlTsQuery query2)
Parameters
query1
NpgsqlTsQueryquery2
NpgsqlTsQuery
Returns
Rank(NpgsqlTsVector, NpgsqlTsQuery)
Calculates the rank of vector
for query
.
http://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-RANKING
public static float Rank(this NpgsqlTsVector vector, NpgsqlTsQuery query)
Parameters
vector
NpgsqlTsVectorquery
NpgsqlTsQuery
Returns
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
NpgsqlTsVectorquery
NpgsqlTsQuerynormalization
NpgsqlTsRankingNormalization
Returns
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
NpgsqlTsVectorweights
float[]query
NpgsqlTsQuery
Returns
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
NpgsqlTsVectorweights
float[]query
NpgsqlTsQuerynormalization
NpgsqlTsRankingNormalization
Returns
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
NpgsqlTsVectorquery
NpgsqlTsQuery
Returns
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
NpgsqlTsVectorquery
NpgsqlTsQuerynormalization
NpgsqlTsRankingNormalization
Returns
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
NpgsqlTsVectorweights
float[]query
NpgsqlTsQuery
Returns
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
NpgsqlTsVectorweights
float[]query
NpgsqlTsQuerynormalization
NpgsqlTsRankingNormalization
Returns
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
NpgsqlTsQuerytarget
NpgsqlTsQuerysubstitute
NpgsqlTsQuery
Returns
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
NpgsqlTsQueryselect
string
Returns
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
NpgsqlTsVectorweight
NpgsqlTsVector.Lexeme.Weight
Returns
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
NpgsqlTsVectorweight
NpgsqlTsVector.Lexeme.Weightlexemes
string[]
Returns
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
NpgsqlTsVectorweight
char
Returns
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
NpgsqlTsVectorweight
charlexemes
string[]
Returns
ToNegative(NpgsqlTsQuery)
Negate a tsquery. Generates the "!!" operator. http://www.postgresql.org/docs/current/static/textsearch-features.html#TEXTSEARCH-MANIPULATE-TSQUERY
public static NpgsqlTsQuery ToNegative(this NpgsqlTsQuery query)
Parameters
query
NpgsqlTsQuery
Returns
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
NpgsqlTsQueryquery2
NpgsqlTsQuery
Returns
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
NpgsqlTsQueryquery2
NpgsqlTsQuerydistance
int
Returns
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