mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Rename tsvector delete() to ts_delete(), and filter() to ts_filter().
The similarity of the original names to SQL keywords seems like a bad idea. Rename them before we're stuck with 'em forever. In passing, minor code and docs cleanup. Discussion: <4875.1462210058@sss.pgh.pa.us>
This commit is contained in:
@ -9177,6 +9177,18 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>
|
||||
<indexterm>
|
||||
<primary>array_to_tsvector</primary>
|
||||
</indexterm>
|
||||
<literal><function>array_to_tsvector(<type>text[]</>)</function></literal>
|
||||
</entry>
|
||||
<entry><type>tsvector</type></entry>
|
||||
<entry>convert array of lexemes to <type>tsvector</type></entry>
|
||||
<entry><literal>array_to_tsvector('{fat,cat,rat}'::text[])</literal></entry>
|
||||
<entry><literal>'fat' 'cat' 'rat'</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<indexterm>
|
||||
@ -9267,10 +9279,10 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
|
||||
<primary>setweight</primary>
|
||||
<secondary>setweight for specific lexeme(s)</secondary>
|
||||
</indexterm>
|
||||
<literal><function>setweight(<replaceable class="PARAMETER">vector</replaceable> <type>tsvector</>, <replaceable class="PARAMETER">weight</replaceable> <type>"char"</>, <replaceable class="PARAMETER">lexemes</replaceable> <type>"text"[]</>)</function></literal>
|
||||
<literal><function>setweight(<replaceable class="PARAMETER">vector</replaceable> <type>tsvector</>, <replaceable class="PARAMETER">weight</replaceable> <type>"char"</>, <replaceable class="PARAMETER">lexemes</replaceable> <type>text[]</>)</function></literal>
|
||||
</entry>
|
||||
<entry><type>tsvector</type></entry>
|
||||
<entry>assign <replaceable class="PARAMETER">weight</replaceable> to elements of <replaceable class="PARAMETER">vector</replaceable> that are listed in <replaceable class="PARAMETER">lexemes</replaceable> array</entry>
|
||||
<entry>assign <replaceable class="PARAMETER">weight</replaceable> to elements of <replaceable class="PARAMETER">vector</replaceable> that are listed in <replaceable class="PARAMETER">lexemes</replaceable></entry>
|
||||
<entry><literal>setweight('fat:2,4 cat:3 rat:5B'::tsvector, 'A', '{cat,rat}')</literal></entry>
|
||||
<entry><literal>'cat':3A 'fat':2,4 'rat':5A</literal></entry>
|
||||
</row>
|
||||
@ -9286,79 +9298,6 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
|
||||
<entry><literal>strip('fat:2,4 cat:3 rat:5A'::tsvector)</literal></entry>
|
||||
<entry><literal>'cat' 'fat' 'rat'</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<indexterm>
|
||||
<primary>delete</primary>
|
||||
<secondary>delete lexeme(s) from tsvector</secondary>
|
||||
</indexterm>
|
||||
<literal><function>delete(<replaceable class="PARAMETER">vector</replaceable> <type>tsvector</>, <replaceable class="PARAMETER">lexeme</replaceable> <type>text</>)</function></literal>
|
||||
</entry>
|
||||
<entry><type>tsvector</type></entry>
|
||||
<entry>remove given <replaceable class="PARAMETER">lexeme</replaceable> from <replaceable class="PARAMETER">vector</replaceable></entry>
|
||||
<entry><literal>delete('fat:2,4 cat:3 rat:5A'::tsvector, 'fat')</literal></entry>
|
||||
<entry><literal>'cat':3 'rat':5A</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<!-- previous indexterm entry covers this too -->
|
||||
<literal><function>delete(<replaceable class="PARAMETER">vector</replaceable> <type>tsvector</>, <replaceable class="PARAMETER">lexemes</replaceable> <type>text[]</>)</function></literal>
|
||||
</entry>
|
||||
<entry><type>tsvector</type></entry>
|
||||
<entry>remove any occurrence of lexemes in <replaceable class="PARAMETER">lexemes</replaceable> array from <replaceable class="PARAMETER">vector</replaceable></entry>
|
||||
<entry><literal>delete('fat:2,4 cat:3 rat:5A'::tsvector, ARRAY['fat','rat'])</literal></entry>
|
||||
<entry><literal>'cat':3</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<indexterm>
|
||||
<primary>unnest</primary>
|
||||
<secondary>for tsvector</secondary>
|
||||
</indexterm>
|
||||
<literal><function>unnest(<type>tsvector</>, OUT <replaceable class="PARAMETER">lexeme</> <type>text</>, OUT <replaceable class="PARAMETER">positions</> <type>smallint[]</>, OUT <replaceable class="PARAMETER">weights</> <type>text</>)</function></literal>
|
||||
</entry>
|
||||
<entry><type>setof record</type></entry>
|
||||
<entry>expand a tsvector to a set of rows</entry>
|
||||
<entry><literal>unnest('fat:2,4 cat:3 rat:5A'::tsvector)</literal></entry>
|
||||
<entry><literal>(cat,{3},{D}) ...</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<indexterm>
|
||||
<primary>tsvector_to_array</primary>
|
||||
</indexterm>
|
||||
<literal><function>tsvector_to_array(<type>tsvector</>)</function></literal>
|
||||
</entry>
|
||||
<entry><type>text[]</type></entry>
|
||||
<entry>convert <type>tsvector</> to array of lexemes</entry>
|
||||
<entry><literal>tsvector_to_array('fat:2,4 cat:3 rat:5A'::tsvector)</literal></entry>
|
||||
<entry><literal>{cat,fat,rat}</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<indexterm>
|
||||
<primary>array_to_tsvector</primary>
|
||||
</indexterm>
|
||||
<literal><function>array_to_tsvector(<type>text[]</>)</function></literal>
|
||||
</entry>
|
||||
<entry><type>tsvector</type></entry>
|
||||
<entry>convert array of lexemes to <type>tsvector</type></entry>
|
||||
<entry><literal>array_to_tsvector('{fat,cat,rat}'::text[])</literal></entry>
|
||||
<entry><literal>'fat' 'cat' 'rat'</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<indexterm>
|
||||
<primary>filter</primary>
|
||||
<secondary>for tsvector</secondary>
|
||||
</indexterm>
|
||||
<literal><function>filter(<replaceable class="PARAMETER">vector</replaceable> <type>tsvector</>, <replaceable class="PARAMETER">weights</replaceable> <type>"char"[]</>)</function></literal>
|
||||
</entry>
|
||||
<entry><type>tsvector</type></entry>
|
||||
<entry>Select only elements with given <replaceable class="PARAMETER">weights</replaceable> from <replaceable class="PARAMETER">vector</replaceable></entry>
|
||||
<entry><literal>filter('fat:2,4 cat:3b rat:5A'::tsvector, '{a,b}')</literal></entry>
|
||||
<entry><literal>'cat':3B 'rat':5A</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<indexterm>
|
||||
@ -9383,6 +9322,40 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
|
||||
<entry><literal>to_tsvector('english', 'The Fat Rats')</literal></entry>
|
||||
<entry><literal>'fat':2 'rat':3</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<indexterm>
|
||||
<primary>ts_delete</primary>
|
||||
</indexterm>
|
||||
<literal><function>ts_delete(<replaceable class="PARAMETER">vector</replaceable> <type>tsvector</>, <replaceable class="PARAMETER">lexeme</replaceable> <type>text</>)</function></literal>
|
||||
</entry>
|
||||
<entry><type>tsvector</type></entry>
|
||||
<entry>remove given <replaceable class="PARAMETER">lexeme</replaceable> from <replaceable class="PARAMETER">vector</replaceable></entry>
|
||||
<entry><literal>ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, 'fat')</literal></entry>
|
||||
<entry><literal>'cat':3 'rat':5A</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<!-- previous indexterm entry covers this too -->
|
||||
<literal><function>ts_delete(<replaceable class="PARAMETER">vector</replaceable> <type>tsvector</>, <replaceable class="PARAMETER">lexemes</replaceable> <type>text[]</>)</function></literal>
|
||||
</entry>
|
||||
<entry><type>tsvector</type></entry>
|
||||
<entry>remove any occurrence of lexemes in <replaceable class="PARAMETER">lexemes</replaceable> from <replaceable class="PARAMETER">vector</replaceable></entry>
|
||||
<entry><literal>ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, ARRAY['fat','rat'])</literal></entry>
|
||||
<entry><literal>'cat':3</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<indexterm>
|
||||
<primary>ts_filter</primary>
|
||||
</indexterm>
|
||||
<literal><function>ts_filter(<replaceable class="PARAMETER">vector</replaceable> <type>tsvector</>, <replaceable class="PARAMETER">weights</replaceable> <type>"char"[]</>)</function></literal>
|
||||
</entry>
|
||||
<entry><type>tsvector</type></entry>
|
||||
<entry>Select only elements with given <replaceable class="PARAMETER">weights</replaceable> from <replaceable class="PARAMETER">vector</replaceable></entry>
|
||||
<entry><literal>ts_filter('fat:2,4 cat:3b rat:5A'::tsvector, '{a,b}')</literal></entry>
|
||||
<entry><literal>'cat':3B 'rat':5A</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<indexterm>
|
||||
@ -9459,6 +9432,18 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
|
||||
<entry><literal>tsquery_phrase(to_tsquery('fat'), to_tsquery('cat'), 10)</literal></entry>
|
||||
<entry><literal>'fat' <10> 'cat'</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<indexterm>
|
||||
<primary>tsvector_to_array</primary>
|
||||
</indexterm>
|
||||
<literal><function>tsvector_to_array(<type>tsvector</>)</function></literal>
|
||||
</entry>
|
||||
<entry><type>text[]</type></entry>
|
||||
<entry>convert <type>tsvector</> to array of lexemes</entry>
|
||||
<entry><literal>tsvector_to_array('fat:2,4 cat:3 rat:5A'::tsvector)</literal></entry>
|
||||
<entry><literal>{cat,fat,rat}</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<indexterm>
|
||||
@ -9483,6 +9468,19 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
|
||||
<entry><literal>CREATE TRIGGER ... tsvector_update_trigger_column(tsvcol, configcol, title, body)</literal></entry>
|
||||
<entry><literal></literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<indexterm>
|
||||
<primary>unnest</primary>
|
||||
<secondary>for tsvector</secondary>
|
||||
</indexterm>
|
||||
<literal><function>unnest(<type>tsvector</>, OUT <replaceable class="PARAMETER">lexeme</> <type>text</>, OUT <replaceable class="PARAMETER">positions</> <type>smallint[]</>, OUT <replaceable class="PARAMETER">weights</> <type>text</>)</function></literal>
|
||||
</entry>
|
||||
<entry><type>setof record</type></entry>
|
||||
<entry>expand a tsvector to a set of rows</entry>
|
||||
<entry><literal>unnest('fat:2,4 cat:3 rat:5A'::tsvector)</literal></entry>
|
||||
<entry><literal>(cat,{3},{D}) ...</literal></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
@ -1412,7 +1412,8 @@ FROM (SELECT id, body, q, ts_rank_cd(ti, q) AS rank
|
||||
</variablelist>
|
||||
|
||||
<para>
|
||||
Full list of <type>tsvector</>-related functions available in <xref linkend="textsearch-functions-table">.
|
||||
A full list of <type>tsvector</>-related functions is available
|
||||
in <xref linkend="textsearch-functions-table">.
|
||||
</para>
|
||||
|
||||
</sect2>
|
||||
|
Reference in New Issue
Block a user