云服务器内容精选

  • 词典测试 函数ts_lexize用于进行词典测试。 ts_lexize(dict regdictionary, token text) returns text[]如果输入的token可以被词典识别,那么ts_lexize返回词素的数组;如果token可以被词典识别但它是一个停用词,则返回空数组;如果是一个不可识别的词则返回NULL。 比如: 1 2 3 4 5 6 7 8 9 SELECT ts_lexize('english_stem', 'stars'); ts_lexize ----------- {star} SELECT ts_lexize('english_stem', 'a'); ts_lexize ----------- {} ts_lexize函数支持单一token,不支持文本。 父主题: 测试和调试文本搜索
  • 分词器测试 函数ts_debug允许简单测试文本搜索分词器。 1 2 3 4 5 6 7 8 ts_debug([ config regconfig, ] document text, OUT alias text, OUT description text, OUT token text, OUT dictionaries regdictionary[], OUT dictionary regdictionary, OUT lexemes text[]) returns setof record ts_debug显示document的每个token信息,token是由解析器生成,由指定的词典进行处理。如果忽略对应参数,则使用config指定的分词器或者default_text_search_config指定的分词器。 ts_debug为文本解析器标识的每个token返回一行记录。记录中的列分别是: alias:text类型,token的别名。 description:text类型,token的描述。 token:text类型,token的文本内容。 dictionaries:regdictionary数组类型,是分词器为token选定的词典。 dictionary:regdictionary类型,用来识别token的词典。如果为空,则不做识别。 lexemes:text数组类型,词典识别token时生成的词素。如果为空,则不生成词素。空数组({})意味着token将被识别成停用词。 一个简单的例子: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 SELECT * FROM ts_debug('english','a fat cat sat on a mat - it ate a fat rats'); alias | description | token | dictionaries | dictionary | lexemes -----------+-----------------+-------+----------------+--------------+--------- asciiword | Word, all ASCII | a | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | fat | {english_stem} | english_stem | {fat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | cat | {english_stem} | english_stem | {cat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | sat | {english_stem} | english_stem | {sat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | on | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | a | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | mat | {english_stem} | english_stem | {mat} blank | Space symbols | | {} | | blank | Space symbols | - | {} | | asciiword | Word, all ASCII | it | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | ate | {english_stem} | english_stem | {ate} blank | Space symbols | | {} | | asciiword | Word, all ASCII | a | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | fat | {english_stem} | english_stem | {fat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | rats | {english_stem} | english_stem | {rat} (24 rows) 父主题: 测试和调试文本搜索
  • 解析器测试 函数ts_parse可以直接测试文本搜索解析器。 1 2 ts_parse(parser_name text, document text, OUT tokid integer, OUT token text) returns setof record ts_parse解析指定的document并返回一系列的记录,一条记录代表一个解析生成的token。每条记录包括标识token类型的tokid,及token文本。比如: 1 2 3 4 5 6 7 8 9 10 SELECT * FROM ts_parse('default', '123 - a number'); tokid | token -------+-------- 22 | 123 12 | 12 | - 1 | a 12 | 1 | number (6 rows) 1 2 ts_token_type(parser_name text, OUT tokid integer, OUT alias text, OUT description text) returns setof record ts_token_type返回一个表,这个表描述了指定解析器可以识别的每种token类型。对于每个token类型,表中给出了整数类型的tokid--用于解析器标记对应的token类型;alias——命名分词器命令中的token类型;及简单描述。比如: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 SELECT * FROM ts_token_type('default'); tokid | alias | description -------+-----------------+------------------------------------------ 1 | asciiword | Word, all ASCII 2 | word | Word, all letters 3 | numword | Word, letters and digits 4 | email | Email address 5 | url | URL 6 | host | Host 7 | sfloat | Scientific notation 8 | version | Version number 9 | hword_numpart | Hyphenated word part, letters and digits 10 | hword_part | Hyphenated word part, all letters 11 | hword_asciipart | Hyphenated word part, all ASCII 12 | blank | Space symbols 13 | tag | XML tag 14 | protocol | Protocol head 15 | numhword | Hyphenated word, letters and digits 16 | asciihword | Hyphenated word, all ASCII 17 | hword | Hyphenated word, all letters 18 | url_path | URL path 19 | file | File or path name 20 | float | Decimal notation 21 | int | Signed integer 22 | uint | Unsigned integer 23 | entity | XML entity (23 rows) 父主题: 测试和调试文本搜索
  • 词典测试 函数ts_lexize用于进行词典测试。 ts_lexize(dict regdictionary, token text) returns text[]如果输入的token可以被词典识别,那么ts_lexize返回词素的数组;如果token可以被词典识别但它是一个停用词,则返回空数组;如果是一个不可识别的词则返回NULL。 比如: 1 2 3 4 5 6 7 8 9 SELECT ts_lexize('english_stem', 'stars'); ts_lexize ----------- {star} SELECT ts_lexize('english_stem', 'a'); ts_lexize ----------- {} ts_lexize函数支持单一token,不支持文本。 父主题: 测试和调试文本搜索
  • 词典测试 函数ts_lexize用于进行词典测试。 ts_lexize(dict regdictionary, token text) returns text[]如果输入的token可以被词典识别,那么ts_lexize返回词素的数组;如果token可以被词典识别到它是一个停用词,则返回空数组;如果是一个不可识别的词则返回NULL。 比如: 1 2 3 4 5 6 7 8 9 gaussdb=# SELECT ts_lexize('english_stem', 'stars'); ts_lexize ----------- {star} gaussdb=# SELECT ts_lexize('english_stem', 'a'); ts_lexize ----------- {} ts_lexize函数支持单一token,不支持文本。 父主题: 测试和调试文本搜索
  • 分词器测试 函数ts_debug允许简单测试文本搜索分词器。 1 2 3 4 5 6 7 8 ts_debug([ config regconfig, ] document text, OUT alias text, OUT description text, OUT token text, OUT dictionaries regdictionary[], OUT dictionary regdictionary, OUT lexemes text[]) returns setof record ts_debug显示document的每个token信息,token是由解析器生成,由指定的词典进行处理。如果忽略对应参数,则使用config指定的分词器或者default_text_search_config指定的分词器。 ts_debug为文本解析器标识的每个token返回一行记录。记录中的列分别是: alias:text类型,token的别名。 description:text类型,token的描述。 token:text类型,token的文本内容。 dictionaries:regdictionary数组类型,是分词器为token选定的词典。 dictionary:regdictionary类型,用来识别token的词典。如果为空,则不做识别。 lexemes:text数组类型,词典识别token时生成的词素。如果为空,则不生成词素。空数组({})意味着token将被识别成停用词。 一个简单的例子: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 postgres=# SELECT * FROM ts_debug('english','a fat cat sat on a mat - it ate a fat rats'); alias | description | token | dictionaries | dictionary | lexemes -----------+-----------------+-------+----------------+--------------+--------- asciiword | Word, all ASCII | a | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | fat | {english_stem} | english_stem | {fat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | cat | {english_stem} | english_stem | {cat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | sat | {english_stem} | english_stem | {sat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | on | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | a | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | mat | {english_stem} | english_stem | {mat} blank | Space symbols | | {} | | blank | Space symbols | - | {} | | asciiword | Word, all ASCII | it | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | ate | {english_stem} | english_stem | {ate} blank | Space symbols | | {} | | asciiword | Word, all ASCII | a | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | fat | {english_stem} | english_stem | {fat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | rats | {english_stem} | english_stem | {rat} (24 rows) 父主题: 测试和调试文本搜索
  • 词典测试 函数ts_lexize用于进行词典测试。 ts_lexize(dict regdictionary, token text) returns text[]如果输入的token可以被词典识别,那么ts_lexize返回词素的数组;如果token可以被词典识别到它是一个停用词,则返回空数组;如果是一个不可识别的词则返回NULL。 比如: 1 2 3 4 5 6 7 8 9 gaussdb=# SELECT ts_lexize('english_stem', 'stars'); ts_lexize ----------- {star} gaussdb=# SELECT ts_lexize('english_stem', 'a'); ts_lexize ----------- {} ts_lexize函数支持单一token,不支持文本。 父主题: 测试和调试文本搜索
  • 分词器测试 函数ts_debug允许简单测试文本搜索分词器。 1 2 3 4 5 6 7 8 ts_debug([ config regconfig, ] document text, OUT alias text, OUT description text, OUT token text, OUT dictionaries regdictionary[], OUT dictionary regdictionary, OUT lexemes text[]) returns setof record ts_debug显示document的每个token信息,token是由解析器生成,由指定的词典进行处理。如果忽略对应参数,则使用config指定的分词器或者default_text_search_config指定的分词器。 ts_debug为文本解析器标识的每个token返回一行记录。记录中的列分别是: alias:text类型,token的别名。 description:text类型,token的描述。 token:text类型,token的文本内容。 dictionaries:regdictionary数组类型,是分词器为token选定的词典。 dictionary:regdictionary类型,用来识别token的词典。如果为空,则不做识别。 lexemes:text数组类型,词典识别token时生成的词素。如果为空,则不生成词素。空数组({})意味着token将被识别成停用词。 一个简单的例子: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 gaussdb=# SELECT * FROM ts_debug('english','a fat cat sat on a mat - it ate a fat rats'); alias | description | token | dictionaries | dictionary | lexemes -----------+-----------------+-------+----------------+--------------+--------- asciiword | Word, all ASCII | a | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | fat | {english_stem} | english_stem | {fat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | cat | {english_stem} | english_stem | {cat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | sat | {english_stem} | english_stem | {sat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | on | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | a | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | mat | {english_stem} | english_stem | {mat} blank | Space symbols | | {} | | blank | Space symbols | - | {} | | asciiword | Word, all ASCII | it | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | ate | {english_stem} | english_stem | {ate} blank | Space symbols | | {} | | asciiword | Word, all ASCII | a | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | fat | {english_stem} | english_stem | {fat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | rats | {english_stem} | english_stem | {rat} (24 rows) 父主题: 测试和调试文本搜索
  • 解析器测试 函数ts_parse可以直接测试文本搜索解析器。 1 2 ts_parse(parser_name text, document text, OUT tokid integer, OUT token text) returns setof record ts_parse解析指定的document并返回一系列的记录,一条记录代表一个解析生成的token。每条记录包括标识token类型的tokid,及token文本。例如: 1 2 3 4 5 6 7 8 9 10 postgres=# SELECT * FROM ts_parse('default', '123 - a number'); tokid | token -------+-------- 22 | 123 12 | 12 | - 1 | a 12 | 1 | number (6 rows) 函数ts_token_type返回指定解析器的token类型及其描述信息。 1 2 ts_token_type(parser_name text, OUT tokid integer, OUT alias text, OUT description text) returns setof record ts_token_type返回一个表,这个表描述了指定解析器可以识别的每种token类型。对于每个token类型,表中给出了整数类型的tokid--用于解析器标记对应的token类型;alias——命名分词器命令中的token类型;及简单描述。比如: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 postgres=# SELECT * FROM ts_token_type('default'); tokid | alias | description -------+-----------------+------------------------------------------ 1 | asciiword | Word, all ASCII 2 | word | Word, all letters 3 | numword | Word, letters and digits 4 | email | Email address 5 | url | URL 6 | host | Host 7 | sfloat | Scientific notation 8 | version | Version number 9 | hword_numpart | Hyphenated word part, letters and digits 10 | hword_part | Hyphenated word part, all letters 11 | hword_asciipart | Hyphenated word part, all ASCII 12 | blank | Space symbols 13 | tag | XML tag 14 | protocol | Protocol head 15 | numhword | Hyphenated word, letters and digits 16 | asciihword | Hyphenated word, all ASCII 17 | hword | Hyphenated word, all letters 18 | url_path | URL path 19 | file | File or path name 20 | float | Decimal notation 21 | int | Signed integer 22 | uint | Unsigned integer 23 | entity | XML entity (23 rows) 父主题: 测试和调试文本搜索
  • 分词器测试 函数ts_debug允许简单测试文本搜索分词器。 1 2 3 4 5 6 7 8 ts_debug([ config regconfig, ] document text, OUT alias text, OUT description text, OUT token text, OUT dictionaries regdictionary[], OUT dictionary regdictionary, OUT lexemes text[]) returns setof record ts_debug显示document的每个token信息,token是由解析器生成,由指定的词典进行处理。如果忽略对应参数,则使用config指定的分词器或者default_text_search_config指定的分词器。 ts_debug为文本解析器标识的每个token返回一行记录。记录中的列分别是: alias:text类型,token的别名。 description:text类型,token的描述。 token:text类型,token的文本内容。 dictionaries:regdictionary数组类型,是分词器为token选定的词典。 dictionary:regdictionary类型,用来识别token的词典。如果为空,则不做识别。 lexemes:text数组类型,词典识别token时生成的词素。如果为空,则不生成词素。空数组({})意味着token将被识别成停用词。 一个简单的例子: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 openGauss=# SELECT * FROM ts_debug('english','a fat cat sat on a mat - it ate a fat rats'); alias | description | token | dictionaries | dictionary | lexemes -----------+-----------------+-------+----------------+--------------+--------- asciiword | Word, all ASCII | a | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | fat | {english_stem} | english_stem | {fat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | cat | {english_stem} | english_stem | {cat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | sat | {english_stem} | english_stem | {sat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | on | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | a | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | mat | {english_stem} | english_stem | {mat} blank | Space symbols | | {} | | blank | Space symbols | - | {} | | asciiword | Word, all ASCII | it | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | ate | {english_stem} | english_stem | {ate} blank | Space symbols | | {} | | asciiword | Word, all ASCII | a | {english_stem} | english_stem | {} blank | Space symbols | | {} | | asciiword | Word, all ASCII | fat | {english_stem} | english_stem | {fat} blank | Space symbols | | {} | | asciiword | Word, all ASCII | rats | {english_stem} | english_stem | {rat} (24 rows) 父主题: 测试和调试文本搜索
  • 解析器测试 函数ts_parse可以直接测试文本搜索解析器。 1 2 ts_parse(parser_name text, document text, OUT tokid integer, OUT token text) returns setof record ts_parse解析指定的document并返回一系列的记录,一条记录代表一个解析生成的token。每条记录包括标识token类型的tokid,及token文本。例如: 1 2 3 4 5 6 7 8 9 10 openGauss=# SELECT * FROM ts_parse('default', '123 - a number'); tokid | token -------+-------- 22 | 123 12 | 12 | - 1 | a 12 | 1 | number (6 rows) 函数ts_token_type返回指定解析器的token类型及其描述信息。 1 2 ts_token_type(parser_name text, OUT tokid integer, OUT alias text, OUT description text) returns setof record ts_token_type返回一个表,这个表描述了指定解析器可以识别的每种token类型。对于每个token类型,表中给出了整数类型的tokid--用于解析器标记对应的token类型;alias——命名分词器命令中的token类型;及简单描述。比如: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 openGauss=# SELECT * FROM ts_token_type('default'); tokid | alias | description -------+-----------------+------------------------------------------ 1 | asciiword | Word, all ASCII 2 | word | Word, all letters 3 | numword | Word, letters and digits 4 | email | Email address 5 | url | URL 6 | host | Host 7 | sfloat | Scientific notation 8 | version | Version number 9 | hword_numpart | Hyphenated word part, letters and digits 10 | hword_part | Hyphenated word part, all letters 11 | hword_asciipart | Hyphenated word part, all ASCII 12 | blank | Space symbols 13 | tag | XML tag 14 | protocol | Protocol head 15 | numhword | Hyphenated word, letters and digits 16 | asciihword | Hyphenated word, all ASCII 17 | hword | Hyphenated word, all letters 18 | url_path | URL path 19 | file | File or path name 20 | float | Decimal notation 21 | int | Signed integer 22 | uint | Unsigned integer 23 | entity | XML entity (23 rows) 父主题: 测试和调试文本搜索
  • 词典测试 函数ts_lexize用于进行词典测试。 ts_lexize(dict regdictionary, token text) returns text[]如果输入的token可以被词典识别,那么ts_lexize返回词素的数组;如果token可以被词典识别到它是一个停用词,则返回空数组;如果是一个不可识别的词则返回NULL。 比如: 1 2 3 4 5 6 7 8 9 openGauss=# SELECT ts_lexize('english_stem', 'stars'); ts_lexize ----------- {star} openGauss=# SELECT ts_lexize('english_stem', 'a'); ts_lexize ----------- {} ts_lexize函数支持单一token,不支持文本。 父主题: 测试和调试文本搜索
  • age解析器测试 函数ts_parse可以直接测试文本搜索解析器。 1 2 ts_parse(parser_name text, document text, OUT tokid integer, OUT token text) returns setof record ts_parse解析指定的document并返回一系列的记录,一条记录代表一个解析生成的token。每条记录包括标识token类型的tokid,及token文本。例如: 1 2 3 4 5 6 7 8 9 10 openGauss=# SELECT * FROM ts_parse('default', '123 - a number'); tokid | token -------+-------- 22 | 123 12 | 12 | - 1 | a 12 | 1 | number (6 rows) 函数ts_token_type返回指定解析器的token类型及其描述信息。 1 2 ts_token_type(parser_name text, OUT tokid integer, OUT alias text, OUT description text) returns setof record ts_token_type返回一个表,这个表描述了指定解析器可以识别的每种token类型。对于每个token类型,表中给出了整数类型的tokid--用于解析器标记对应的token类型;alias——命名分词器命令中的token类型;及简单描述。比如: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 openGauss=# SELECT * FROM ts_token_type('default'); tokid | alias | description -------+-----------------+------------------------------------------ 1 | asciiword | Word, all ASCII 2 | word | Word, all letters 3 | numword | Word, letters and digits 4 | email | Email address 5 | url | URL 6 | host | Host 7 | sfloat | Scientific notation 8 | version | Version number 9 | hword_numpart | Hyphenated word part, letters and digits 10 | hword_part | Hyphenated word part, all letters 11 | hword_asciipart | Hyphenated word part, all ASCII 12 | blank | Space symbols 13 | tag | XML tag 14 | protocol | Protocol head 15 | numhword | Hyphenated word, letters and digits 16 | asciihword | Hyphenated word, all ASCII 17 | hword | Hyphenated word, all letters 18 | url_path | URL path 19 | file | File or path name 20 | float | Decimal notation 21 | int | Signed integer 22 | uint | Unsigned integer 23 | entity | XML entity (23 rows) 父主题: 测试和调试文本搜索
  • 解析器测试 函数ts_parse可以直接测试文本搜索解析器。 1 2 ts_parse(parser_name text, document text, OUT tokid integer, OUT token text) returns setof record ts_parse解析指定的document并返回一系列的记录,一条记录代表一个解析生成的token。每条记录包括标识token类型的tokid,及token文本。比如: 1 2 3 4 5 6 7 8 9 10 SELECT * FROM ts_parse('default', '123 - a number'); tokid | token -------+-------- 22 | 123 12 | 12 | - 1 | a 12 | 1 | number (6 rows) 1 2 ts_token_type(parser_name text, OUT tokid integer, OUT alias text, OUT description text) returns setof record ts_token_type返回一个表,这个表描述了指定解析器可以识别的每种token类型。对于每个token类型,表中给出了整数类型的tokid--用于解析器标记对应的token类型;alias——命名分词器命令中的token类型;及简单描述。比如: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 SELECT * FROM ts_token_type('default'); tokid | alias | description -------+-----------------+------------------------------------------ 1 | asciiword | Word, all ASCII 2 | word | Word, all letters 3 | numword | Word, letters and digits 4 | email | Email address 5 | url | URL 6 | host | Host 7 | sfloat | Scientific notation 8 | version | Version number 9 | hword_numpart | Hyphenated word part, letters and digits 10 | hword_part | Hyphenated word part, all letters 11 | hword_asciipart | Hyphenated word part, all ASCII 12 | blank | Space symbols 13 | tag | XML tag 14 | protocol | Protocol head 15 | numhword | Hyphenated word, letters and digits 16 | asciihword | Hyphenated word, all ASCII 17 | hword | Hyphenated word, all letters 18 | url_path | URL path 19 | file | File or path name 20 | float | Decimal notation 21 | int | Signed integer 22 | uint | Unsigned integer 23 | entity | XML entity (23 rows) 父主题: 测试和调试文本搜索
  • 词典测试 函数ts_lexize用于进行词典测试。 ts_lexize(dict regdictionary, token text) returns text[]如果输入的token可以被词典识别,那么ts_lexize返回词素的数组;如果token可以被词典识别但它是一个停用词,则返回空数组;如果是一个不可识别的词则返回NULL。 比如: 1 2 3 4 5 6 7 8 9 SELECT ts_lexize('english_stem', 'stars'); ts_lexize ----------- {star} SELECT ts_lexize('english_stem', 'a'); ts_lexize ----------- {} ts_lexize函数支持单一token,不支持文本。 父主题: 测试和调试文本搜索