mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Add ts_debug function for debugging configurations
This commit is contained in:
parent
11e9dcc549
commit
dd2870f76f
@ -2056,3 +2056,14 @@ A thousand years to trace
|
|||||||
The granite features of this cliff
|
The granite features of this cliff
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
--check debug
|
||||||
|
select * from ts_debug('Tsearch module for PostgreSQL 7.3.3');
|
||||||
|
ts_name | tok_type | description | token | dict_name | tsvector
|
||||||
|
---------+----------+-------------+------------+-----------+--------------
|
||||||
|
default | lword | Latin word | Tsearch | {en_stem} | 'tsearch'
|
||||||
|
default | lword | Latin word | module | {en_stem} | 'modul'
|
||||||
|
default | lword | Latin word | for | {en_stem} |
|
||||||
|
default | lword | Latin word | PostgreSQL | {en_stem} | 'postgresql'
|
||||||
|
default | version | VERSION | 7.3.3 | {simple} | '7.3.3'
|
||||||
|
(5 rows)
|
||||||
|
|
||||||
|
@ -241,3 +241,5 @@ The sculpture of these granite seams,
|
|||||||
Upon a woman s face. E. J. Pratt (1882 1964)
|
Upon a woman s face. E. J. Pratt (1882 1964)
|
||||||
', to_tsquery('sea'));
|
', to_tsquery('sea'));
|
||||||
|
|
||||||
|
--check debug
|
||||||
|
select * from ts_debug('Tsearch module for PostgreSQL 7.3.3');
|
||||||
|
@ -666,6 +666,42 @@ CREATE FUNCTION get_covers(tsvector,tsquery)
|
|||||||
language 'C'
|
language 'C'
|
||||||
with (isstrict);
|
with (isstrict);
|
||||||
|
|
||||||
|
--debug function
|
||||||
|
create type tsdebug as (
|
||||||
|
ts_name text,
|
||||||
|
tok_type text,
|
||||||
|
description text,
|
||||||
|
token text,
|
||||||
|
dict_name text[],
|
||||||
|
"tsvector" tsvector
|
||||||
|
);
|
||||||
|
|
||||||
|
create function _get_parser_from_curcfg()
|
||||||
|
returns text as
|
||||||
|
' select prs_name from pg_ts_cfg where oid = show_curcfg() '
|
||||||
|
language 'SQL' with(isstrict,iscachable);
|
||||||
|
|
||||||
|
create function ts_debug(text)
|
||||||
|
returns setof tsdebug as '
|
||||||
|
select
|
||||||
|
m.ts_name,
|
||||||
|
t.alias as tok_type,
|
||||||
|
t.descr as description,
|
||||||
|
p.token,
|
||||||
|
m.dict_name,
|
||||||
|
strip(to_tsvector(p.token)) as tsvector
|
||||||
|
from
|
||||||
|
parse( _get_parser_from_curcfg(), $1 ) as p,
|
||||||
|
token_type() as t,
|
||||||
|
pg_ts_cfgmap as m,
|
||||||
|
pg_ts_cfg as c
|
||||||
|
where
|
||||||
|
t.tokid=p.tokid and
|
||||||
|
t.alias = m.tok_alias and
|
||||||
|
m.ts_name=c.ts_name and
|
||||||
|
c.oid=show_curcfg()
|
||||||
|
' language 'SQL' with(isstrict);
|
||||||
|
|
||||||
|
|
||||||
--example of ISpell dictionary
|
--example of ISpell dictionary
|
||||||
--update pg_ts_dict set dict_initoption='DictFile="/usr/local/share/ispell/russian.dict" ,AffFile ="/usr/local/share/ispell/russian.aff", StopFile="/usr/local/share/ispell/russian.stop"' where dict_id=4;
|
--update pg_ts_dict set dict_initoption='DictFile="/usr/local/share/ispell/russian.dict" ,AffFile ="/usr/local/share/ispell/russian.aff", StopFile="/usr/local/share/ispell/russian.stop"' where dict_id=4;
|
||||||
|
@ -26,6 +26,8 @@ DROP TYPE tsquery CASCADE;
|
|||||||
DROP TYPE gtsvector CASCADE;
|
DROP TYPE gtsvector CASCADE;
|
||||||
DROP TYPE tsstat CASCADE;
|
DROP TYPE tsstat CASCADE;
|
||||||
DROP TYPE statinfo CASCADE;
|
DROP TYPE statinfo CASCADE;
|
||||||
|
DROP TYPE tsdebug CASCADE;
|
||||||
|
|
||||||
|
|
||||||
DROP FUNCTION lexize(oid, text) ;
|
DROP FUNCTION lexize(oid, text) ;
|
||||||
DROP FUNCTION lexize(text, text);
|
DROP FUNCTION lexize(text, text);
|
||||||
@ -58,5 +60,6 @@ DROP FUNCTION gtsvector_picksplit(internal, internal);
|
|||||||
DROP FUNCTION gtsvector_union(bytea, internal);
|
DROP FUNCTION gtsvector_union(bytea, internal);
|
||||||
DROP FUNCTION reset_tsearch();
|
DROP FUNCTION reset_tsearch();
|
||||||
DROP FUNCTION tsearch2() CASCADE;
|
DROP FUNCTION tsearch2() CASCADE;
|
||||||
|
DROP FUNCTION _get_parser_from_curcfg();
|
||||||
|
|
||||||
END;
|
END;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user