Commit 0b9a2344 authored by Tom Lane's avatar Tom Lane

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>
parent 2f38b986
...@@ -9177,6 +9177,18 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple ...@@ -9177,6 +9177,18 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
</row> </row>
</thead> </thead>
<tbody> <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> <row>
<entry> <entry>
<indexterm> <indexterm>
...@@ -9267,10 +9279,10 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple ...@@ -9267,10 +9279,10 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
<primary>setweight</primary> <primary>setweight</primary>
<secondary>setweight for specific lexeme(s)</secondary> <secondary>setweight for specific lexeme(s)</secondary>
</indexterm> </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>
<entry><type>tsvector</type></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>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> <entry><literal>'cat':3A 'fat':2,4 'rat':5A</literal></entry>
</row> </row>
...@@ -9289,100 +9301,61 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple ...@@ -9289,100 +9301,61 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
<row> <row>
<entry> <entry>
<indexterm> <indexterm>
<primary>delete</primary> <primary>to_tsquery</primary>
<secondary>delete lexeme(s) from tsvector</secondary>
</indexterm> </indexterm>
<literal><function>delete(<replaceable class="PARAMETER">vector</replaceable> <type>tsvector</>, <replaceable class="PARAMETER">lexeme</replaceable> <type>text</>)</function></literal> <literal><function>to_tsquery(<optional> <replaceable class="PARAMETER">config</> <type>regconfig</> , </optional> <replaceable class="PARAMETER">query</> <type>text</type>)</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>
<entry><type>tsvector</type></entry> <entry><type>tsquery</type></entry>
<entry>remove any occurrence of lexemes in <replaceable class="PARAMETER">lexemes</replaceable> array from <replaceable class="PARAMETER">vector</replaceable></entry> <entry>normalize words and convert to <type>tsquery</></entry>
<entry><literal>delete('fat:2,4 cat:3 rat:5A'::tsvector, ARRAY['fat','rat'])</literal></entry> <entry><literal>to_tsquery('english', 'The &amp; Fat &amp; Rats')</literal></entry>
<entry><literal>'cat':3</literal></entry> <entry><literal>'fat' &amp; 'rat'</literal></entry>
</row> </row>
<row> <row>
<entry> <entry>
<indexterm> <indexterm>
<primary>unnest</primary> <primary>to_tsvector</primary>
<secondary>for tsvector</secondary>
</indexterm> </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> <literal><function>to_tsvector(<optional> <replaceable class="PARAMETER">config</> <type>regconfig</> , </optional> <replaceable class="PARAMETER">document</> <type>text</type>)</function></literal>
</entry> </entry>
<entry><type>setof record</type></entry> <entry><type>tsvector</type></entry>
<entry>expand a tsvector to a set of rows</entry> <entry>reduce document text to <type>tsvector</></entry>
<entry><literal>unnest('fat:2,4 cat:3 rat:5A'::tsvector)</literal></entry> <entry><literal>to_tsvector('english', 'The Fat Rats')</literal></entry>
<entry><literal>(cat,{3},{D}) ...</literal></entry> <entry><literal>'fat':2 'rat':3</literal></entry>
</row> </row>
<row> <row>
<entry> <entry>
<indexterm> <indexterm>
<primary>tsvector_to_array</primary> <primary>ts_delete</primary>
</indexterm> </indexterm>
<literal><function>tsvector_to_array(<type>tsvector</>)</function></literal> <literal><function>ts_delete(<replaceable class="PARAMETER">vector</replaceable> <type>tsvector</>, <replaceable class="PARAMETER">lexeme</replaceable> <type>text</>)</function></literal>
</entry> </entry>
<entry><type>text[]</type></entry> <entry><type>tsvector</type></entry>
<entry>convert <type>tsvector</> to array of lexemes</entry> <entry>remove given <replaceable class="PARAMETER">lexeme</replaceable> from <replaceable class="PARAMETER">vector</replaceable></entry>
<entry><literal>tsvector_to_array('fat:2,4 cat:3 rat:5A'::tsvector)</literal></entry> <entry><literal>ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, 'fat')</literal></entry>
<entry><literal>{cat,fat,rat}</literal></entry> <entry><literal>'cat':3 'rat':5A</literal></entry>
</row> </row>
<row> <row>
<entry> <entry>
<indexterm> <!-- previous indexterm entry covers this too -->
<primary>array_to_tsvector</primary> <literal><function>ts_delete(<replaceable class="PARAMETER">vector</replaceable> <type>tsvector</>, <replaceable class="PARAMETER">lexemes</replaceable> <type>text[]</>)</function></literal>
</indexterm>
<literal><function>array_to_tsvector(<type>text[]</>)</function></literal>
</entry> </entry>
<entry><type>tsvector</type></entry> <entry><type>tsvector</type></entry>
<entry>convert array of lexemes to <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>array_to_tsvector('{fat,cat,rat}'::text[])</literal></entry> <entry><literal>ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, ARRAY['fat','rat'])</literal></entry>
<entry><literal>'fat' 'cat' 'rat'</literal></entry> <entry><literal>'cat':3</literal></entry>
</row> </row>
<row> <row>
<entry> <entry>
<indexterm> <indexterm>
<primary>filter</primary> <primary>ts_filter</primary>
<secondary>for tsvector</secondary>
</indexterm> </indexterm>
<literal><function>filter(<replaceable class="PARAMETER">vector</replaceable> <type>tsvector</>, <replaceable class="PARAMETER">weights</replaceable> <type>"char"[]</>)</function></literal> <literal><function>ts_filter(<replaceable class="PARAMETER">vector</replaceable> <type>tsvector</>, <replaceable class="PARAMETER">weights</replaceable> <type>"char"[]</>)</function></literal>
</entry> </entry>
<entry><type>tsvector</type></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>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>ts_filter('fat:2,4 cat:3b rat:5A'::tsvector, '{a,b}')</literal></entry>
<entry><literal>'cat':3B 'rat':5A</literal></entry> <entry><literal>'cat':3B 'rat':5A</literal></entry>
</row> </row>
<row>
<entry>
<indexterm>
<primary>to_tsquery</primary>
</indexterm>
<literal><function>to_tsquery(<optional> <replaceable class="PARAMETER">config</> <type>regconfig</> , </optional> <replaceable class="PARAMETER">query</> <type>text</type>)</function></literal>
</entry>
<entry><type>tsquery</type></entry>
<entry>normalize words and convert to <type>tsquery</></entry>
<entry><literal>to_tsquery('english', 'The &amp; Fat &amp; Rats')</literal></entry>
<entry><literal>'fat' &amp; 'rat'</literal></entry>
</row>
<row>
<entry>
<indexterm>
<primary>to_tsvector</primary>
</indexterm>
<literal><function>to_tsvector(<optional> <replaceable class="PARAMETER">config</> <type>regconfig</> , </optional> <replaceable class="PARAMETER">document</> <type>text</type>)</function></literal>
</entry>
<entry><type>tsvector</type></entry>
<entry>reduce document text to <type>tsvector</></entry>
<entry><literal>to_tsvector('english', 'The Fat Rats')</literal></entry>
<entry><literal>'fat':2 'rat':3</literal></entry>
</row>
<row> <row>
<entry> <entry>
<indexterm> <indexterm>
...@@ -9459,6 +9432,18 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple ...@@ -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>tsquery_phrase(to_tsquery('fat'), to_tsquery('cat'), 10)</literal></entry>
<entry><literal>'fat' &lt;10&gt; 'cat'</literal></entry> <entry><literal>'fat' &lt;10&gt; 'cat'</literal></entry>
</row> </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> <row>
<entry> <entry>
<indexterm> <indexterm>
...@@ -9483,6 +9468,19 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple ...@@ -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>CREATE TRIGGER ... tsvector_update_trigger_column(tsvcol, configcol, title, body)</literal></entry>
<entry><literal></literal></entry> <entry><literal></literal></entry>
</row> </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> </tbody>
</tgroup> </tgroup>
</table> </table>
......
...@@ -1412,7 +1412,8 @@ FROM (SELECT id, body, q, ts_rank_cd(ti, q) AS rank ...@@ -1412,7 +1412,8 @@ FROM (SELECT id, body, q, ts_rank_cd(ti, q) AS rank
</variablelist> </variablelist>
<para> <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> </para>
</sect2> </sect2>
......
...@@ -506,7 +506,7 @@ tsvector_delete_by_indices(TSVector tsv, int *indices_to_delete, ...@@ -506,7 +506,7 @@ tsvector_delete_by_indices(TSVector tsv, int *indices_to_delete,
/* /*
* Delete given lexeme from tsvector. * Delete given lexeme from tsvector.
* Implementation of user-level delete(tsvector, text). * Implementation of user-level ts_delete(tsvector, text).
*/ */
Datum Datum
tsvector_delete_str(PG_FUNCTION_ARGS) tsvector_delete_str(PG_FUNCTION_ARGS)
...@@ -530,7 +530,7 @@ tsvector_delete_str(PG_FUNCTION_ARGS) ...@@ -530,7 +530,7 @@ tsvector_delete_str(PG_FUNCTION_ARGS)
/* /*
* Delete given array of lexemes from tsvector. * Delete given array of lexemes from tsvector.
* Implementation of user-level delete(tsvector, text[]). * Implementation of user-level ts_delete(tsvector, text[]).
*/ */
Datum Datum
tsvector_delete_arr(PG_FUNCTION_ARGS) tsvector_delete_arr(PG_FUNCTION_ARGS)
...@@ -757,7 +757,7 @@ array_to_tsvector(PG_FUNCTION_ARGS) ...@@ -757,7 +757,7 @@ array_to_tsvector(PG_FUNCTION_ARGS)
} }
/* /*
* Leave only elements with given weights from tsvector. * ts_filter(): keep only lexemes with given weights in tsvector.
*/ */
Datum Datum
tsvector_filter(PG_FUNCTION_ARGS) tsvector_filter(PG_FUNCTION_ARGS)
...@@ -771,15 +771,15 @@ tsvector_filter(PG_FUNCTION_ARGS) ...@@ -771,15 +771,15 @@ tsvector_filter(PG_FUNCTION_ARGS)
*dataout; *dataout;
Datum *dweights; Datum *dweights;
bool *nulls; bool *nulls;
int nweigths; int nweights;
int i, j; int i, j;
int cur_pos = 0; int cur_pos = 0;
char mask = 0; char mask = 0;
deconstruct_array(weights, CHAROID, 1, true, 'c', deconstruct_array(weights, CHAROID, 1, true, 'c',
&dweights, &nulls, &nweigths); &dweights, &nulls, &nweights);
for (i = 0; i < nweigths; i++) for (i = 0; i < nweights; i++)
{ {
char char_weight; char char_weight;
...@@ -804,8 +804,9 @@ tsvector_filter(PG_FUNCTION_ARGS) ...@@ -804,8 +804,9 @@ tsvector_filter(PG_FUNCTION_ARGS)
mask = mask | 1; mask = mask | 1;
break; break;
default: default:
/* internal error */ ereport(ERROR,
elog(ERROR, "unrecognized weight: %c", char_weight); (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("unrecognized weight: \"%c\"", char_weight)));
} }
} }
......
...@@ -53,6 +53,6 @@ ...@@ -53,6 +53,6 @@
*/ */
/* yyyymmddN */ /* yyyymmddN */
#define CATALOG_VERSION_NO 201605031 #define CATALOG_VERSION_NO 201605051
#endif #endif
...@@ -4539,18 +4539,18 @@ DESCR("set given weight for whole tsvector"); ...@@ -4539,18 +4539,18 @@ DESCR("set given weight for whole tsvector");
DATA(insert OID = 3320 ( setweight PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 3614 "3614 18 1009" _null_ _null_ _null_ _null_ _null_ tsvector_setweight_by_filter _null_ _null_ _null_ )); DATA(insert OID = 3320 ( setweight PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 3614 "3614 18 1009" _null_ _null_ _null_ _null_ _null_ tsvector_setweight_by_filter _null_ _null_ _null_ ));
DESCR("set given weight for given lexemes"); DESCR("set given weight for given lexemes");
DATA(insert OID = 3625 ( tsvector_concat PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 3614" _null_ _null_ _null_ _null_ _null_ tsvector_concat _null_ _null_ _null_ )); DATA(insert OID = 3625 ( tsvector_concat PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 3614" _null_ _null_ _null_ _null_ _null_ tsvector_concat _null_ _null_ _null_ ));
DATA(insert OID = 3321 ( delete PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 25" _null_ _null_ _null_ _null_ _null_ tsvector_delete_str _null_ _null_ _null_ )); DATA(insert OID = 3321 ( ts_delete PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 25" _null_ _null_ _null_ _null_ _null_ tsvector_delete_str _null_ _null_ _null_ ));
DESCR("delete lexeme"); DESCR("delete lexeme");
DATA(insert OID = 3323 ( delete PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 1009" _null_ _null_ _null_ _null_ _null_ tsvector_delete_arr _null_ _null_ _null_ )); DATA(insert OID = 3323 ( ts_delete PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 1009" _null_ _null_ _null_ _null_ _null_ tsvector_delete_arr _null_ _null_ _null_ ));
DESCR("delete given lexemes"); DESCR("delete given lexemes");
DATA(insert OID = 3322 ( unnest PGNSP PGUID 12 1 10 0 0 f f f f t t i s 1 0 2249 "3614" "{3614,25,1005,1009}" "{i,o,o,o}" "{tsvector,lexeme,positions,weights}" _null_ _null_ tsvector_unnest _null_ _null_ _null_ )); DATA(insert OID = 3322 ( unnest PGNSP PGUID 12 1 10 0 0 f f f f t t i s 1 0 2249 "3614" "{3614,25,1005,1009}" "{i,o,o,o}" "{tsvector,lexeme,positions,weights}" _null_ _null_ tsvector_unnest _null_ _null_ _null_ ));
DESCR("expand tsvector to set of rows"); DESCR("expand tsvector to set of rows");
DATA(insert OID = 3326 ( tsvector_to_array PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 1009 "3614" _null_ _null_ _null_ _null_ _null_ tsvector_to_array _null_ _null_ _null_ )); DATA(insert OID = 3326 ( tsvector_to_array PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 1009 "3614" _null_ _null_ _null_ _null_ _null_ tsvector_to_array _null_ _null_ _null_ ));
DESCR("convert to lexeme's array"); DESCR("convert tsvector to array of lexemes");
DATA(insert OID = 3327 ( array_to_tsvector PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 3614 "1009" _null_ _null_ _null_ _null_ _null_ array_to_tsvector _null_ _null_ _null_ )); DATA(insert OID = 3327 ( array_to_tsvector PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 3614 "1009" _null_ _null_ _null_ _null_ _null_ array_to_tsvector _null_ _null_ _null_ ));
DESCR("build tsvector from lexeme's array"); DESCR("build tsvector from array of lexemes");
DATA(insert OID = 3319 ( filter PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 1002" _null_ _null_ _null_ _null_ _null_ tsvector_filter _null_ _null_ _null_ )); DATA(insert OID = 3319 ( ts_filter PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 3614 "3614 1002" _null_ _null_ _null_ _null_ _null_ tsvector_filter _null_ _null_ _null_ ));
DESCR("returns tsvector that contain only postings with given weights"); DESCR("delete lexemes that do not have one of the given weights");
DATA(insert OID = 3634 ( ts_match_vq PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 16 "3614 3615" _null_ _null_ _null_ _null_ _null_ ts_match_vq _null_ _null_ _null_ )); DATA(insert OID = 3634 ( ts_match_vq PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 16 "3614 3615" _null_ _null_ _null_ _null_ _null_ ts_match_vq _null_ _null_ _null_ ));
DATA(insert OID = 3635 ( ts_match_qv PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 16 "3615 3614" _null_ _null_ _null_ _null_ _null_ ts_match_qv _null_ _null_ _null_ )); DATA(insert OID = 3635 ( ts_match_qv PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 16 "3615 3614" _null_ _null_ _null_ _null_ _null_ ts_match_qv _null_ _null_ _null_ ));
......
...@@ -979,73 +979,73 @@ SELECT strip('base hidden rebel spaceship strike'::tsvector); ...@@ -979,73 +979,73 @@ SELECT strip('base hidden rebel spaceship strike'::tsvector);
'base' 'hidden' 'rebel' 'spaceship' 'strike' 'base' 'hidden' 'rebel' 'spaceship' 'strike'
(1 row) (1 row)
SELECT delete(to_tsvector('english', 'Rebel spaceships, striking from a hidden base'), 'spaceship'); SELECT ts_delete(to_tsvector('english', 'Rebel spaceships, striking from a hidden base'), 'spaceship');
delete ts_delete
------------------------------------------ ------------------------------------------
'base':7 'hidden':6 'rebel':1 'strike':3 'base':7 'hidden':6 'rebel':1 'strike':3
(1 row) (1 row)
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'base'); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'base');
delete ts_delete
-------------------------------------------------------------- --------------------------------------------------------------
'hidden':6 'rebel':1 'spaceship':2,33A,34B,35C,36 'strike':3 'hidden':6 'rebel':1 'spaceship':2,33A,34B,35C,36 'strike':3
(1 row) (1 row)
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bas'); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bas');
delete ts_delete
----------------------------------------------------------------------- -----------------------------------------------------------------------
'base':7 'hidden':6 'rebel':1 'spaceship':2,33A,34B,35C,36 'strike':3 'base':7 'hidden':6 'rebel':1 'spaceship':2,33A,34B,35C,36 'strike':3
(1 row) (1 row)
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bases'); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bases');
delete ts_delete
----------------------------------------------------------------------- -----------------------------------------------------------------------
'base':7 'hidden':6 'rebel':1 'spaceship':2,33A,34B,35C,36 'strike':3 'base':7 'hidden':6 'rebel':1 'spaceship':2,33A,34B,35C,36 'strike':3
(1 row) (1 row)
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'spaceship'); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'spaceship');
delete ts_delete
------------------------------------------ ------------------------------------------
'base':7 'hidden':6 'rebel':1 'strike':3 'base':7 'hidden':6 'rebel':1 'strike':3
(1 row) (1 row)
SELECT delete('base hidden rebel spaceship strike'::tsvector, 'spaceship'); SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, 'spaceship');
delete ts_delete
---------------------------------- ----------------------------------
'base' 'hidden' 'rebel' 'strike' 'base' 'hidden' 'rebel' 'strike'
(1 row) (1 row)
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','rebel']); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','rebel']);
delete ts_delete
-------------------------------- --------------------------------
'base':7 'hidden':6 'strike':3 'base':7 'hidden':6 'strike':3
(1 row) (1 row)
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceships','rebel']); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceships','rebel']);
delete ts_delete
------------------------------------------------------------- -------------------------------------------------------------
'base':7 'hidden':6 'spaceship':2,33A,34B,35C,36 'strike':3 'base':7 'hidden':6 'spaceship':2,33A,34B,35C,36 'strike':3
(1 row) (1 row)
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceshi','rebel']); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceshi','rebel']);
delete ts_delete
------------------------------------------------------------- -------------------------------------------------------------
'base':7 'hidden':6 'spaceship':2,33A,34B,35C,36 'strike':3 'base':7 'hidden':6 'spaceship':2,33A,34B,35C,36 'strike':3
(1 row) (1 row)
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','leya','rebel']); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','leya','rebel']);
delete ts_delete
-------------------------------- --------------------------------
'base':7 'hidden':6 'strike':3 'base':7 'hidden':6 'strike':3
(1 row) (1 row)
SELECT delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel']); SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel']);
delete ts_delete
-------------------------- --------------------------
'base' 'hidden' 'strike' 'base' 'hidden' 'strike'
(1 row) (1 row)
SELECT delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel', NULL]); SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel', NULL]);
ERROR: lexeme array may not contain nulls ERROR: lexeme array may not contain nulls
SELECT unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); SELECT unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector);
unnest unnest
...@@ -1155,17 +1155,17 @@ SELECT setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', '{a,zxc}'); ...@@ -1155,17 +1155,17 @@ SELECT setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', '{a,zxc}');
SELECT setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', ARRAY['a', 'zxc', NULL]); SELECT setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', ARRAY['a', 'zxc', NULL]);
ERROR: lexeme array may not contain nulls ERROR: lexeme array may not contain nulls
SELECT filter('base:7A empir:17 evil:15 first:11 galact:16 hidden:6A rebel:1A spaceship:2A strike:3A victori:12 won:9'::tsvector, '{a}'); SELECT ts_filter('base:7A empir:17 evil:15 first:11 galact:16 hidden:6A rebel:1A spaceship:2A strike:3A victori:12 won:9'::tsvector, '{a}');
filter ts_filter
------------------------------------------------------------- -------------------------------------------------------------
'base':7A 'hidden':6A 'rebel':1A 'spaceship':2A 'strike':3A 'base':7A 'hidden':6A 'rebel':1A 'spaceship':2A 'strike':3A
(1 row) (1 row)
SELECT filter('base hidden rebel spaceship strike'::tsvector, '{a}'); SELECT ts_filter('base hidden rebel spaceship strike'::tsvector, '{a}');
filter ts_filter
-------- -----------
(1 row) (1 row)
SELECT filter('base hidden rebel spaceship strike'::tsvector, '{a,b,NULL}'); SELECT ts_filter('base hidden rebel spaceship strike'::tsvector, '{a,b,NULL}');
ERROR: weight array may not contain nulls ERROR: weight array may not contain nulls
...@@ -193,19 +193,19 @@ SELECT strip('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd'::tsvector); ...@@ -193,19 +193,19 @@ SELECT strip('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd'::tsvector);
SELECT strip('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); SELECT strip('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector);
SELECT strip('base hidden rebel spaceship strike'::tsvector); SELECT strip('base hidden rebel spaceship strike'::tsvector);
SELECT delete(to_tsvector('english', 'Rebel spaceships, striking from a hidden base'), 'spaceship'); SELECT ts_delete(to_tsvector('english', 'Rebel spaceships, striking from a hidden base'), 'spaceship');
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'base'); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'base');
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bas'); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bas');
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bases'); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bases');
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'spaceship'); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'spaceship');
SELECT delete('base hidden rebel spaceship strike'::tsvector, 'spaceship'); SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, 'spaceship');
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','rebel']); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','rebel']);
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceships','rebel']); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceships','rebel']);
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceshi','rebel']); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceshi','rebel']);
SELECT delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','leya','rebel']); SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','leya','rebel']);
SELECT delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel']); SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel']);
SELECT delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel', NULL]); SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel', NULL]);
SELECT unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); SELECT unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector);
SELECT unnest('base hidden rebel spaceship strike'::tsvector); SELECT unnest('base hidden rebel spaceship strike'::tsvector);
...@@ -227,6 +227,6 @@ SELECT setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', ' ...@@ -227,6 +227,6 @@ SELECT setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '
SELECT setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', '{a,zxc}'); SELECT setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', '{a,zxc}');
SELECT setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', ARRAY['a', 'zxc', NULL]); SELECT setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', ARRAY['a', 'zxc', NULL]);
SELECT filter('base:7A empir:17 evil:15 first:11 galact:16 hidden:6A rebel:1A spaceship:2A strike:3A victori:12 won:9'::tsvector, '{a}'); SELECT ts_filter('base:7A empir:17 evil:15 first:11 galact:16 hidden:6A rebel:1A spaceship:2A strike:3A victori:12 won:9'::tsvector, '{a}');
SELECT filter('base hidden rebel spaceship strike'::tsvector, '{a}'); SELECT ts_filter('base hidden rebel spaceship strike'::tsvector, '{a}');
SELECT filter('base hidden rebel spaceship strike'::tsvector, '{a,b,NULL}'); SELECT ts_filter('base hidden rebel spaceship strike'::tsvector, '{a,b,NULL}');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment