<xref linkend="textsearch-operators-table"/>, <xref linkend="textsearch-functions-table"/> and <xref linkend="textsearch-functions-debug-table"/> summarize the functions and operators that are provided for full text searching. See <xref linkend="textsearch"/> for a detailed explanation of <productname>PostgreSQL</productname>'s text search facility. 表 9.42、表 9.43および表 9.44は全文検索用に提供されている関数と演算子を要約しています。PostgreSQLのテキスト検索機能の詳細は第12章を参照してください。
表9.42 テキスト検索演算子
Operator 演算子 Description 説明 Example(s) 例 |
---|
Does <type>tsvector</type> match <type>tsquery</type>?
(The arguments can be given in either order.)
|
Does text string, after implicit invocation
of <function>to_tsvector()</function>, match <type>tsquery</type>?
テキスト文字列は
|
Concatenates two <type>tsvector</type>s. If both inputs contain
lexeme positions, the second input's positions are adjusted
accordingly.
2つの
|
ANDs two <type>tsquery</type>s together, producing a query that
matches documents that match both input queries.
2つの
|
ORs two <type>tsquery</type>s together, producing a query that
matches documents that match either input query.
2つの
|
Negates a <type>tsquery</type>, producing a query that matches
documents that do not match the input query.
|
Constructs a phrase query, which matches if the two input queries match at successive lexemes. 2つの入力問い合わせが連続する語彙素にマッチする場合にマッチする語句問い合わせを作成します。
|
Does first <type>tsquery</type> contain the second? (This considers
only whether all the lexemes appearing in one query appear in the
other, ignoring the combining operators.)
最初の
|
Is first <type>tsquery</type> contained in the second? (This
considers only whether all the lexemes appearing in one query appear
in the other, ignoring the combining operators.)
最初の
|
In addition to these specialized operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
available for types <type>tsvector</type> and <type>tsquery</type>.
These are not very
useful for text searching but allow, for example, unique indexes to be
built on columns of these types.
表に示された演算子に加え、表 9.1で示す通常の比較演算子型tsvector
およびtsquery
に対して利用できます。
これらはテキスト検索に対してそれほど有用ではありませんが、例えばこれらの型の列に一意インデックスを作成することを可能にします。
表9.43 テキスト検索関数
Function 関数 Description 説明 Example(s) 例 |
---|
Converts an array of text strings to a <type>tsvector</type>.
The given strings are used as lexemes as-is, without further
processing. Array elements must not be empty strings
or <literal>NULL</literal>.
文字列の配列を
|
Returns the OID of the current default text search configuration (as set by <xref linkend="guc-default-text-search-config"/>). (default_text_search_configで設定された)現在のテキスト検索設定のOIDを返します。
|
Returns the number of lexemes in the <type>tsvector</type>.
|
Returns the number of lexemes plus operators in
the <type>tsquery</type>.
|
Converts text to a <type>tsquery</type>, normalizing words according to
the specified or default configuration. Any punctuation in the string
is ignored (it does not determine query operators). The resulting
query matches documents containing all non-stopwords in the text.
指定されたデフォルト設定にしたがって単語を正規化してテキストを
|
Converts text to a <type>tsquery</type>, normalizing words according to
the specified or default configuration. Any punctuation in the string
is ignored (it does not determine query operators). The resulting
query matches phrases containing all non-stopwords in the text.
指定されたデフォルト設定にしたがって単語を正規化してテキストを
|
Converts text to a <type>tsquery</type>, normalizing words according
to the specified or default configuration. Quoted word sequences are
converted to phrase tests. The word <quote>or</quote> is understood
as producing an OR operator, and a dash produces a NOT operator;
other punctuation is ignored.
This approximates the behavior of some common web search tools.
指定されたデフォルト設定にしたがって単語を正規化してテキストを
|
Produces a representation of the indexable portion of
a <type>tsquery</type>. A result that is empty or
just <literal>T</literal> indicates a non-indexable query.
|
Assigns the specified <parameter>weight</parameter> to each element
of the <parameter>vector</parameter>.
|
Assigns the specified <parameter>weight</parameter> to elements
of the <parameter>vector</parameter> that are listed
in <parameter>lexemes</parameter>.
The strings in <parameter>lexemes</parameter> are taken as lexemes
as-is, without further processing. Strings that do not match any
lexeme in <parameter>vector</parameter> are ignored.
|
Removes positions and weights from the <type>tsvector</type>.
位置と重みを
|
Converts text to a <type>tsquery</type>, normalizing words according to
the specified or default configuration. The words must be combined
by valid <type>tsquery</type> operators.
指定されたデフォルト設定にしたがって単語を正規化してテキストを
|
Converts text to a <type>tsvector</type>, normalizing words according
to the specified or default configuration. Position information is
included in the result.
指定されたデフォルト設定にしたがって単語を正規化してテキストを
|
Converts each string value in the JSON document to
a <type>tsvector</type>, normalizing words according to the specified
or default configuration. The results are then concatenated in
document order to produce the output. Position information is
generated as though one stopword exists between each pair of string
values. (Beware that <quote>document order</quote> of the fields of a
JSON object is implementation-dependent when the input
is <type>jsonb</type>; observe the difference in the examples.)
指定されたデフォルト設定にしたがって正規化してJSON文書中の文字列値を
|
Selects each item in the JSON document that is requested by
the <parameter>filter</parameter> and converts each one to
a <type>tsvector</type>, normalizing words according to the specified
or default configuration. The results are then concatenated in
document order to produce the output. Position information is
generated as though one stopword exists between each pair of selected
items. (Beware that <quote>document order</quote> of the fields of a
JSON object is implementation-dependent when the input
is <type>jsonb</type>.)
The <parameter>filter</parameter> must be a <type>jsonb</type>
array containing zero or more of these keywords:
<literal>"string"</literal> (to include all string values),
<literal>"numeric"</literal> (to include all numeric values),
<literal>"boolean"</literal> (to include all boolean values),
<literal>"key"</literal> (to include all keys), or
<literal>"all"</literal> (to include all the above).
As a special case, the <parameter>filter</parameter> can also be a
simple JSON value that is one of these keywords.
|
Removes any occurrence of the given <parameter>lexeme</parameter>
from the <parameter>vector</parameter>.
The <parameter>lexeme</parameter> string is treated as a lexeme as-is,
without further processing.
|
Removes any occurrences of the lexemes
in <parameter>lexemes</parameter>
from the <parameter>vector</parameter>.
The strings in <parameter>lexemes</parameter> are taken as lexemes
as-is, without further processing. Strings that do not match any
lexeme in <parameter>vector</parameter> are ignored.
|
Selects only elements with the given <parameter>weights</parameter>
from the <parameter>vector</parameter>.
|
Displays, in an abbreviated form, the match(es) for
the <parameter>query</parameter> in
the <parameter>document</parameter>, which must be raw text not
a <type>tsvector</type>. Words in the document are normalized
according to the specified or default configuration before matching to
the query. Use of this function is discussed in
<xref linkend="textsearch-headline"/>, which also describes the
available <parameter>options</parameter>.
|
Displays, in an abbreviated form, match(es) for
the <parameter>query</parameter> that occur in string values
within the JSON <parameter>document</parameter>.
See <xref linkend="textsearch-headline"/> for more details.
JSON
|
Computes a score showing how well
the <parameter>vector</parameter> matches
the <parameter>query</parameter>. See
<xref linkend="textsearch-ranking"/> for details.
|
Computes a score showing how well
the <parameter>vector</parameter> matches
the <parameter>query</parameter>, using a cover density
algorithm. See <xref linkend="textsearch-ranking"/> for details.
被覆密度アルゴリズムを用いて
|
Replaces occurrences of <parameter>target</parameter>
with <parameter>substitute</parameter>
within the <parameter>query</parameter>.
See <xref linkend="textsearch-query-rewriting"/> for details.
|
Replaces portions of the <parameter>query</parameter> according to
target(s) and substitute(s) obtained by executing
a <command>SELECT</command> command.
See <xref linkend="textsearch-query-rewriting"/> for details.
|
Constructs a phrase query that searches
for matches of <parameter>query1</parameter>
and <parameter>query2</parameter> at successive lexemes (same
as <literal><-></literal> operator).
連続する語彙素で
|
Constructs a phrase query that searches
for matches of <parameter>query1</parameter> and
<parameter>query2</parameter> that occur exactly
<parameter>distance</parameter> lexemes apart.
語彙素が正確に
|
Converts a <type>tsvector</type> to an array of lexemes.
|
Expands a <type>tsvector</type> into a set of rows, one per lexeme.
1行につき1語彙素で
lexeme | positions | weights --------+-----------+--------- cat | {3} | {D} fat | {2,4} | {D,D} rat | {5} | {A}
|
All the text search functions that accept an optional <type>regconfig</type>
argument will use the configuration specified by
<xref linkend="guc-default-text-search-config"/>
when that argument is omitted.
オプションのregconfig
引数を受け付ける全てのテキスト検索関数は、その引数が省略された場合default_text_search_configで指定された設定を使用します。
The functions in <xref linkend="textsearch-functions-debug-table"/> 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. 表 9.44の関数は、日常のテキスト検索操作では通常使用されないので、別の表にしました。 これらは主に新しいテキスト検索設定の開発およびデバッグに役立ちます。
表9.44 テキスト検索デバッグ関数
Function 関数 Description 説明 Example(s) 例 |
---|
Extracts and normalizes tokens from
the <parameter>document</parameter> according to the specified or
default text search configuration, and returns information about how
each token was processed.
See <xref linkend="textsearch-configuration-testing"/> for details.
指定した、あるいはデフォルトの設定にしたがって
|
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 <xref linkend="textsearch-dictionary-testing"/> for details. 入力トークンが辞書にあれば代替の語彙素の配列、辞書にあるがストップワードである場合には空の配列、未知の単語ならNULLを返します。 詳細は12.8.3を見てください。
|
Extracts tokens from the <parameter>document</parameter> using the
named parser.
See <xref linkend="textsearch-parser-testing"/> for details.
名前で指定したパーサを使って
|
Extracts tokens from the <parameter>document</parameter> using a
parser specified by OID.
See <xref linkend="textsearch-parser-testing"/> for details.
OIDで指定されたパーサを使って
|
Returns a table that describes each type of token the named parser can recognize. See <xref linkend="textsearch-parser-testing"/> for details. 名前で指定したパーサが認識できるトークンの型を記述するテーブルを返します。 詳細は12.8.2を見てください。
|
Returns a table that describes each type of token a parser specified by OID can recognize. See <xref linkend="textsearch-parser-testing"/> for details. OIDで指定したパーサが認識できるトークンの型を記述するテーブルを返します。 詳細は12.8.2を見てください。
|
Executes the <parameter>sqlquery</parameter>, which must return a
single <type>tsvector</type> column, and returns statistics about each
distinct lexeme contained in the data.
See <xref linkend="textsearch-statistics"/> for details.
単一の
|