MATCH operator
The MATCH operator creates a property that implements full-text search. For pattern matching, use the separate LIKE operator.
Syntax
searchExpr MATCH compareExpr
Description
The MATCH operator compares searchExpr with a search string or a prepared search query. The % and _ characters in compareExpr are not wildcard characters.
- If both
MATCHoperands belong to string classes, the platform converts them using the current full-text search language and returnsTRUEif either the full-text condition or the case-insensitive substring inclusion check succeeds. - Prepared full-text values are supported only in their standard roles:
TSVECTORinsearchExprandTSQUERYincompareExpr. In these roles, the platform uses the prepared value directly and converts only the string operand, if any; the additional substring inclusion check is not added. - Values of type
TSVECTORandTSQUERYare usually obtained with thetoTsVectorandtoTsQueryfunctions.
Parameters
-
searchExprExpression whose value determines the source string or prepared search vector.
The value of the expression must belong to one of the string classes or have type
TSVECTOR. -
compareExprExpression whose value determines the search string or prepared search query.
The value of the expression must belong to one of the string classes or have type
TSQUERY.
Examples
matchesByWords(STRING content, STRING query) = content MATCH query; // full-text search over a string
matchesPrepared(STRING content, TSQUERY query) = content MATCH query; // prepared TSQUERY on the right
matchesVectorByString(TSVECTOR vector, STRING query) = vector MATCH query; // the string on the right is converted to TSQUERY
matchesVector(TSVECTOR vector, TSQUERY query) = vector MATCH query; // direct TSVECTOR-to-TSQUERY match