array_to_tsvector(text[] )
| tsvector | convert array of lexemes totsvector | array_to_tsvector('{fat,cat,rat}'::text[]) | 'cat' 'fat' 'rat' |
get_current_ts_config()
| regconfig | get default text search configuration | get_current_ts_config() | english |
length(tsvector )
| integer | number of lexemes intsvector | length('fat:2,4 cat:3 rat:5A'::tsvector) | 3 |
numnode(tsquery )
| integer | number of lexemes plus operators intsquery | numnode('(fat & rat) | cat'::tsquery) | 5 |
plainto_tsquery([config regconfig ,]query text )
| tsquery | producetsquery ignoring punctuation | plainto_tsquery('english', 'The Fat Rats') | 'fat' & 'rat' |
phraseto_tsquery([config regconfig ,]query text )
| tsquery | producetsquery that searches for a phrase, ignoring punctuation | phraseto_tsquery('english', 'The Fat Rats') | 'fat' <-> 'rat' |
websearch_to_tsquery([config regconfig ,]query text )
| tsquery | producetsquery from a web search style query | websearch_to_tsquery('english', '"fat rat" or rat') | 'fat' <-> 'rat' | 'rat' |
querytree(query tsquery )
| text | get indexable part of atsquery | querytree('foo & ! bar'::tsquery) | 'foo' |
setweight(vector tsvector ,weight "char" )
| tsvector | assignweight to each element ofvector | setweight('fat:2,4 cat:3 rat:5B'::tsvector, 'A') | 'cat':3A 'fat':2A,4A 'rat':5A |
setweight(vector tsvector ,weight "char" ,lexemes text[] )
| tsvector | assignweight to elements ofvector that are listed inlexemes | setweight('fat:2,4 cat:3 rat:5B'::tsvector, 'A', '{cat,rat}') | 'cat':3A 'fat':2,4 'rat':5A |
strip(tsvector )
| tsvector | remove positions and weights fromtsvector | strip('fat:2,4 cat:3 rat:5A'::tsvector) | 'cat' 'fat' 'rat' |
to_tsquery([config regconfig ,]query text )
| tsquery | normalize words and convert totsquery | to_tsquery('english', 'The & Fat & Rats') | 'fat' & 'rat' |
to_tsvector([config regconfig ,]document text )
| tsvector | reduce document text totsvector | to_tsvector('english', 'The Fat Rats') | 'fat':2 'rat':3 |
to_tsvector([config regconfig ,]document json(b) )
| tsvector | reduce each string value in the document to atsvector , and then concatenate those in document order to produce a singletsvector | to_tsvector('english', '{"a": "The Fat Rats"}'::json) | 'fat':2 'rat':3 |
json(b)_to_tsvector([config regconfig ,]document json(b) ,filter json(b) )
| tsvector | reduce each value in the document, specified byfilter to atsvector , and then concatenate those in document order to produce a singletsvector .filter is ajsonb array, that enumerates what kind of elements need to be included into the resultingtsvector . Possible values forfilter are"string" (to include all string values),"numeric" (to include all numeric values in the string format),"boolean" (to include all Boolean values in the string format"true" /"false" ),"key" (to include all keys) or"all" (to include all above). These values can be combined together to include, e.g., all string and numeric values. | json_to_tsvector('english', '{"a": "The Fat Rats", "b": 123}'::json, '["string", "numeric"]') | '123':5 'fat':2 'rat':3 |
ts_delete(vector tsvector ,lexeme text )
| tsvector | remove givenlexeme fromvector | ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, 'fat') | 'cat':3 'rat':5A |
ts_delete(vector tsvector ,lexemes text[] )
| tsvector | remove any occurrence of lexemes inlexemes fromvector | ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, ARRAY['fat','rat']) | 'cat':3 |
ts_filter(vector tsvector ,weights "char"[] )
| tsvector | select only elements with givenweights fromvector | ts_filter('fat:2,4 cat:3b rat:5A'::tsvector, '{a,b}') | 'cat':3B 'rat':5A |
ts_headline([config regconfig ,]document text ,query tsquery [,options text ])
| text | display a query match | ts_headline('x y z', 'z'::tsquery) | x y <b>z</b> |
ts_headline([config regconfig ,]document json(b) ,query tsquery [,options text ])
| text | display a query match | ts_headline('{"a":"x y z"}'::json, 'z'::tsquery) | {"a":"x y <b>z</b>"} |
ts_rank([weights float4[] ,]vector tsvector ,query tsquery [,normalization integer ])
| float4 | rank document for query | ts_rank(textsearch, query) | 0.818 |
ts_rank_cd([weights float4[] ,]vector tsvector ,query tsquery [,normalization integer ])
| float4 | rank document for query using cover density | ts_rank_cd('{0.1, 0.2, 0.4, 1.0}', textsearch, query) | 2.01317 |
ts_rewrite(query tsquery ,target tsquery ,substitute tsquery )
| tsquery | replacetarget withsubstitute within query | ts_rewrite('a & b'::tsquery, 'a'::tsquery, 'foo|bar'::tsquery) | 'b' & ( 'foo' | 'bar' ) |
ts_rewrite(query tsquery ,select text )
| tsquery | replace using targets and substitutes from aSELECT command | SELECT ts_rewrite('a & b'::tsquery, 'SELECT t,s FROM aliases') | 'b' & ( 'foo' | 'bar' ) |
tsquery_phrase(query1 tsquery ,query2 tsquery )
| tsquery | make query that searches forquery1 followed byquery2 (same as<-> operator) | tsquery_phrase(to_tsquery('fat'), to_tsquery('cat')) | 'fat' <-> 'cat' |
tsquery_phrase(query1 tsquery ,query2 tsquery ,distance integer )
| tsquery | make query that searches forquery1 followed byquery2 at distancedistance | tsquery_phrase(to_tsquery('fat'), to_tsquery('cat'), 10) | 'fat' <10> 'cat' |
tsvector_to_array(tsvector )
| text[] | converttsvector to array of lexemes | tsvector_to_array('fat:2,4 cat:3 rat:5A'::tsvector) | {cat,fat,rat} |
tsvector_update_trigger()
| trigger | trigger function for automatictsvector column update | CREATE TRIGGER ... tsvector_update_trigger(tsvcol, 'pg_catalog.swedish', title, body) |
|
tsvector_update_trigger_column()
| trigger | trigger function for automatictsvector column update | CREATE TRIGGER ... tsvector_update_trigger_column(tsvcol, configcol, title, body) |
|
unnest(tsvector , OUTlexeme text , OUTpositions smallint[] , OUTweights text )
| setof record | expand atsvector to a set of rows | unnest('fat:2,4 cat:3 rat:5A'::tsvector) | (cat,{3},{D}) ... |