array_to_tsvector ( text[] ) → tsvector 將詞素數組轉換為tsvector 。給定的字符串按原樣使用,不做進一步處理。 array_to_tsvector('{fat,cat,rat}'::text[]) → 'cat' 'fat' 'rat'
|
get_current_ts_config ( ) → regconfig 返回當前默認文本搜索配置的OID(由 default_text_search_config 所設定的) get_current_ts_config() → english
|
length ( tsvector ) → integer 返回tsvector 中的詞位數。 length('fat:2,4 cat:3 rat:5A'::tsvector) → 3
|
numnode ( tsquery ) → integer 返回tsquery 中詞位和操作符的數目。 numnode('(fat & rat) | cat'::tsquery) → 5
|
plainto_tsquery ( [ config regconfig , ] query text ) → tsquery 將文本轉換為tsquery ,根據指定的或默認配置對單詞進行標準化。 字符串中的任何標點符號都會被忽略(它不決定查詢操作符)。結果查詢匹配文本中包含所有非停止詞的文檔。 plainto_tsquery('english', 'The Fat Rats') → 'fat' & 'rat'
|
phraseto_tsquery ( [ config regconfig , ] query text ) → tsquery 將文本轉換為tsquery ,根據指定的或默認配置對單詞進行標準化。 字符串中的任何標點符號都會被忽略(它不決定查詢操作符)。結果查詢匹配包含文本中所有非停止詞的短語。 phraseto_tsquery('english', 'The Fat Rats') → 'fat' <-> 'rat'
phraseto_tsquery('english', 'The Cat and Rats') → 'cat' <2> 'rat'
|
websearch_to_tsquery ( [ config regconfig , ] query text ) → tsquery 將文本轉換為tsquery ,根據指定的或默認配置對單詞進行標準化。引用的單詞序列被轉換為短語測試。 “or”一詞被理解為產生OR操作符,而破折號產生NOT操作符;其他標點符號被忽略。這類似于一些常見的網絡搜索工具的行為。 websearch_to_tsquery('english', '"fat rat" or cat dog') → 'fat' <-> 'rat' | 'cat' & 'dog'
|
querytree ( tsquery ) → text 生成tsquery 的可轉位部分的表示。結果為空或僅為T 表示不可索引查詢。 querytree('foo & ! bar'::tsquery) → 'foo'
|
setweight ( vector tsvector , weight "char" ) → tsvector 將指定的weight 賦給vector 的每個元素。 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 將指定的weight 賦給列在lexemes 中的vector 元素。 setweight('fat:2,4 cat:3 rat:5,6B'::tsvector, 'A', '{cat,rat}') → 'cat':3A 'fat':2,4 'rat':5A,6A
|
strip ( tsvector ) → tsvector 從tsvector 中移除位置和權重。 strip('fat:2,4 cat:3 rat:5A'::tsvector) → 'cat' 'fat' 'rat'
|
to_tsquery ( [ config regconfig , ] query text ) → tsquery 將文本轉換為tsquery ,根據指定的或默認配置對單詞進行標準化。單詞必須由有效的tsquery 操作符組合。 to_tsquery('english', 'The & Fat & Rats') → 'fat' & 'rat'
|
to_tsvector ( [ config regconfig , ] document text ) → tsvector 將文本轉換為tsvector ,根據指定的或默認配置對單詞進行標準化。結果中包含位置信息。 to_tsvector('english', 'The Fat Rats') → 'fat':2 'rat':3
|
to_tsvector ( [ config regconfig , ] document json ) → tsvector
to_tsvector ( [ config regconfig , ] document jsonb ) → tsvector
將JSON文檔中的每個字符串值轉換為tsvector ,根據指定的或默認配置對單詞進行標準化。 然后將結果按文檔順序連接起來以產生輸出。位置信息就像在每對字符串值之間存在一個停止詞一樣生成。 (注意,當輸入為jsonb 時,JSON對象的字段的“document order”取決于實現;請觀察這些例子中的差異) to_tsvector('english', '{"aa": "The Fat Rats", "b": "dog"}'::json) → 'dog':5 'fat':2 'rat':3
to_tsvector('english', '{"aa": "The Fat Rats", "b": "dog"}'::jsonb) → 'dog':1 'fat':4 'rat':5
|
json_to_tsvector ( [ config regconfig , ] document json , filter jsonb ) → tsvector jsonb_to_tsvector ( [ config regconfig , ] document jsonb , filter jsonb ) → tsvector 選擇filter 請求的JSON文檔中的每個項,并將每個項轉換為tsvector ,根據指定的或默認配置對單詞進行標準化。 然后將結果按文檔順序連接起來以產生輸出。位置信息就像在每對選定的項目之間存在一個停止詞一樣生成。 (注意,當輸入為jsonb 時,JSON對象字段的“document order”取決于實現) filter 必須是一個jsonb 數組,其中包含0個或多個關鍵字: "string" (包括所有字符串值), "numeric" (包括所有數值),"boolean" (包括所有布爾值),"key" (包括所有鍵),或 "all" (包括以上所有關鍵字)。 作為一種特殊情況,該filter 也可以是這些關鍵字之一的簡單JSON值。 json_to_tsvector('english', '{"a": "The Fat Rats", "b": 123}'::json, '["string", "numeric"]') → '123':5 'fat':2 'rat':3
json_to_tsvector('english', '{"cat": "The Fat Rats", "dog": 123}'::json, '"all"') → '123':9 'cat':1 'dog':7 'fat':4 'rat':5
|
ts_delete ( vector tsvector , lexeme text ) → tsvector 從vector 中刪除任何出現的給定lexeme 。 ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, 'fat') → 'cat':3 'rat':5A
|
ts_delete ( vector tsvector , lexemes text[] ) → tsvector
從vector 中刪除lexemes 中出現的任何詞位。 ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, ARRAY['fat','rat']) → 'cat':3
|
ts_filter ( vector tsvector , weights "char"[] ) → tsvector 只從vector 中選擇具有給定weights 的元素。 ts_filter('fat:2,4 cat:3b,7c rat:5A'::tsvector, '{a,b}') → 'cat':3B 'rat':5A
|
ts_headline ( [ config regconfig , ] document text , query tsquery [, options text ] ) → text 以縮寫形式顯示document 中query 的匹配項,該匹配項必須是原始文本,而不是tsvector 。 在匹配查詢之前,文檔中的單詞將根據指定的或默認的配置進行規范化。 ts_headline('The fat cat ate the rat.', 'cat') → The fat <b>cat</b> ate the rat.
|
ts_headline ( [ config regconfig , ] document json , query tsquery [, options text ] ) → text
ts_headline ( [ config regconfig , ] document jsonb , query tsquery [, options text ] ) → text
以縮寫形式顯示匹配JSONdocument 中字符串值中的query 。 ts_headline('{"cat":"raining cats and dogs"}'::jsonb, 'cat') → {"cat": "raining <b>cats</b> and dogs"}
|
ts_rank ( [ weights real[] , ] vector tsvector , query tsquery [, normalization integer ] ) → real 計算一個分數,顯示vector 與query 的匹配程度。 ts_rank(to_tsvector('raining cats and dogs'), 'cat') → 0.06079271
|
ts_rank_cd ( [ weights real[] , ] vector tsvector , query tsquery [, normalization integer ] ) → real 使用覆蓋密度算法計算一個分數,顯示vector 與query 的匹配程度。 ts_rank_cd(to_tsvector('raining cats and dogs'), 'cat') → 0.1
|
ts_rewrite ( query tsquery , target tsquery , substitute tsquery ) → tsquery 在query 中使用 substitute 替換出現的target 。 ts_rewrite('a & b'::tsquery, 'a'::tsquery, 'foo|bar'::tsquery) → 'b' & ( 'foo' | 'bar' )
|
ts_rewrite ( query tsquery , select text ) → tsquery
根據目標替換部分query ,并替換通過執行SELECT 命令獲得的查詢。 SELECT ts_rewrite('a & b'::tsquery, 'SELECT t,s FROM aliases') → 'b' & ( 'foo' | 'bar' )
|
tsquery_phrase ( query1 tsquery , query2 tsquery ) → tsquery 構造一個短語查詢,在連續的詞位上搜索query1 和query2 的匹配項(與<-> 操作符相同)。 tsquery_phrase(to_tsquery('fat'), to_tsquery('cat')) → 'fat' <-> 'cat'
|
tsquery_phrase ( query1 tsquery , query2 tsquery , distance integer ) → tsquery
構造一個短語查詢,用于搜索query1 和query2 的匹配項,這些匹配項恰好出現在distance 詞位之間。 tsquery_phrase(to_tsquery('fat'), to_tsquery('cat'), 10) → 'fat' <10> 'cat'
|
tsvector_to_array ( tsvector ) → text[] 將tsvector 轉換為詞位的數組。 tsvector_to_array('fat:2,4 cat:3 rat:5A'::tsvector) → {cat,fat,rat}
|
unnest ( tsvector ) → setof record ( lexeme text , positions smallint[] , weights text ) 將tsvector 展開為一組行,每個行對應一個詞位。 select * from unnest('cat:3 fat:2,4 rat:5A'::tsvector) →
|