From 0b9a23443283f9ffb17a39c25f74adefdb72cae1 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 5 May 2016 19:43:32 -0400 Subject: 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> --- doc/src/sgml/func.sgml | 132 +++++++++++++++++++++---------------------- doc/src/sgml/textsearch.sgml | 3 +- 2 files changed, 67 insertions(+), 68 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index e1c3b48bf40..c8dd838d253 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -9177,6 +9177,18 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple + + + + array_to_tsvector + + array_to_tsvector(text[]) + + tsvector + convert array of lexemes to tsvector + array_to_tsvector('{fat,cat,rat}'::text[]) + 'fat' 'cat' 'rat' + @@ -9267,10 +9279,10 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple setweight setweight for specific lexeme(s) - setweight(vector tsvector, weight "char", lexemes "text"[]) + setweight(vector tsvector, weight "char", lexemes text[]) tsvector - assign weight to elements of vector that are listed in lexemes array + assign weight to elements of vector that are listed in lexemes setweight('fat:2,4 cat:3 rat:5B'::tsvector, 'A', '{cat,rat}') 'cat':3A 'fat':2,4 'rat':5A @@ -9289,100 +9301,61 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple - delete - delete lexeme(s) from tsvector + to_tsquery - delete(vector tsvector, lexeme text) - - tsvector - remove given lexeme from vector - delete('fat:2,4 cat:3 rat:5A'::tsvector, 'fat') - 'cat':3 'rat':5A - - - - - delete(vector tsvector, lexemes text[]) + to_tsquery( config regconfig , query text) - tsvector - remove any occurrence of lexemes in lexemes array from vector - delete('fat:2,4 cat:3 rat:5A'::tsvector, ARRAY['fat','rat']) - 'cat':3 + tsquery + normalize words and convert to tsquery + to_tsquery('english', 'The & Fat & Rats') + 'fat' & 'rat' - unnest - for tsvector + to_tsvector - unnest(tsvector, OUT lexeme text, OUT positions smallint[], OUT weights text) + to_tsvector( config regconfig , document text) - setof record - expand a tsvector to a set of rows - unnest('fat:2,4 cat:3 rat:5A'::tsvector) - (cat,{3},{D}) ... + tsvector + reduce document text to tsvector + to_tsvector('english', 'The Fat Rats') + 'fat':2 'rat':3 - tsvector_to_array + ts_delete - tsvector_to_array(tsvector) + ts_delete(vector tsvector, lexeme text) - text[] - convert tsvector to array of lexemes - tsvector_to_array('fat:2,4 cat:3 rat:5A'::tsvector) - {cat,fat,rat} + tsvector + remove given lexeme from vector + ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, 'fat') + 'cat':3 'rat':5A - - array_to_tsvector - - array_to_tsvector(text[]) + + ts_delete(vector tsvector, lexemes text[]) tsvector - convert array of lexemes to tsvector - array_to_tsvector('{fat,cat,rat}'::text[]) - 'fat' 'cat' 'rat' + remove any occurrence of lexemes in lexemes from vector + ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, ARRAY['fat','rat']) + 'cat':3 - filter - for tsvector + ts_filter - filter(vector tsvector, weights "char"[]) + ts_filter(vector tsvector, weights "char"[]) tsvector Select only elements with given weights from vector - filter('fat:2,4 cat:3b rat:5A'::tsvector, '{a,b}') + ts_filter('fat:2,4 cat:3b rat:5A'::tsvector, '{a,b}') 'cat':3B 'rat':5A - - - - to_tsquery - - to_tsquery( config regconfig , query text) - - tsquery - normalize words and convert to tsquery - to_tsquery('english', 'The & Fat & Rats') - 'fat' & 'rat' - - - - - to_tsvector - - to_tsvector( config regconfig , document text) - - tsvector - reduce document text to tsvector - to_tsvector('english', 'The Fat Rats') - 'fat':2 'rat':3 - @@ -9459,6 +9432,18 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple tsquery_phrase(to_tsquery('fat'), to_tsquery('cat'), 10) 'fat' <10> 'cat' + + + + tsvector_to_array + + tsvector_to_array(tsvector) + + text[] + convert tsvector to array of lexemes + tsvector_to_array('fat:2,4 cat:3 rat:5A'::tsvector) + {cat,fat,rat} + @@ -9483,6 +9468,19 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple CREATE TRIGGER ... tsvector_update_trigger_column(tsvcol, configcol, title, body) + + + + unnest + for tsvector + + unnest(tsvector, OUT lexeme text, OUT positions smallint[], OUT weights text) + + setof record + expand a tsvector to a set of rows + unnest('fat:2,4 cat:3 rat:5A'::tsvector) + (cat,{3},{D}) ... + diff --git a/doc/src/sgml/textsearch.sgml b/doc/src/sgml/textsearch.sgml index 78eaf748676..bee1fbf1749 100644 --- a/doc/src/sgml/textsearch.sgml +++ b/doc/src/sgml/textsearch.sgml @@ -1412,7 +1412,8 @@ FROM (SELECT id, body, q, ts_rank_cd(ti, q) AS rank - Full list of tsvector-related functions available in . + A full list of tsvector-related functions is available + in . -- cgit v1.2.3