9.13. Text Search Functions and Operators
Table 9.42 , Table 9.43 and Table 9.44 summarize the functions and operators that are provided for full text searching. See Chapter 12 for a detailed explanation of PostgreSQL 's text search facility.
Table 9.42. Text Search Operators
Operator Description Example(s) |
---|
Does
|
Does text string, after implicit invocation
of
|
Concatenates two
|
ANDs two
|
ORs two
|
Negates a
|
Constructs a phrase query, which matches if the two input queries match at successive lexemes.
|
Does first
|
Is first
|
In addition to these specialized operators, the usual comparison
operators shown in
Table 9.1
are
available for types
tsvector
and
tsquery
.
These are not very
useful for text searching but allow, for example, unique indexes to be
built on columns of these types.
Table 9.43. Text Search Functions
Function Description Example(s) |
---|
Converts an array of text strings to a
|
Returns the OID of the current default text search configuration (as set by default_text_search_config ).
|
Returns the number of lexemes in the
|
Returns the number of lexemes plus operators in
the
|
Converts text to a
|
Converts text to a
|
Converts text to a
|
Produces a representation of the indexable portion of
a
|
Assigns the specified
|
Assigns the specified
|
Removes positions and weights from the
|
Converts text to a
|
Converts text to a
|
Converts each string value in the JSON document to
a
|
Selects each item in the JSON document that is requested by
the
|
Removes any occurrence of the given
|
Removes any occurrences of the lexemes
in
|
Selects only elements with the given
|
Displays, in an abbreviated form, the match(es) for
the
|
Displays, in an abbreviated form, match(es) for
the
|
Computes a score showing how well
the
|
Computes a score showing how well
the
|
Replaces occurrences of
|
Replaces portions of the
|
Constructs a phrase query that searches
for matches of
|
Constructs a phrase query that searches
for matches of
|
Converts a
|
Expands a
lexeme | positions | weights --------+-----------+--------- cat | {3} | {D} fat | {2,4} | {D,D} rat | {5} | {A}
|
Note
All the text search functions that accept an optional
regconfig
argument will use the configuration specified by
default_text_search_config
when that argument is omitted.
The functions in Table 9.44 are listed separately because they are not usually used in everyday text searching operations. They are primarily helpful for development and debugging of new text search configurations.
Table 9.44. Text Search Debugging Functions
Function Description Example(s) |
---|
Extracts and normalizes tokens from
the
|
Returns an array of replacement lexemes if the input token is known to the dictionary, or an empty array if the token is known to the dictionary but it is a stop word, or NULL if it is not a known word. See Section 12.8.3 for details.
|
Extracts tokens from the
|
Extracts tokens from the
|
Returns a table that describes each type of token the named parser can recognize. See Section 12.8.2 for details.
|
Returns a table that describes each type of token a parser specified by OID can recognize. See Section 12.8.2 for details.
|
Executes the
|