Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdd2870f

Browse files
committed
Add ts_debug function for debugging configurations
1 parent11e9dcc commitdd2870f

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

‎contrib/tsearch2/expected/tsearch2.out

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,3 +2056,14 @@ A thousand years to trace
20562056
The granite features of this cliff
20572057
(1 row)
20582058

2059+
--check debug
2060+
select * from ts_debug('Tsearch module for PostgreSQL 7.3.3');
2061+
ts_name | tok_type | description | token | dict_name | tsvector
2062+
---------+----------+-------------+------------+-----------+--------------
2063+
default | lword | Latin word | Tsearch | {en_stem} | 'tsearch'
2064+
default | lword | Latin word | module | {en_stem} | 'modul'
2065+
default | lword | Latin word | for | {en_stem} |
2066+
default | lword | Latin word | PostgreSQL | {en_stem} | 'postgresql'
2067+
default | version | VERSION | 7.3.3 | {simple} | '7.3.3'
2068+
(5 rows)
2069+

‎contrib/tsearch2/sql/tsearch2.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,5 @@ The sculpture of these granite seams,
241241
Upon a woman s face. E. J. Pratt (1882 1964)
242242
', to_tsquery('sea'));
243243

244+
--check debug
245+
select*from ts_debug('Tsearch module for PostgreSQL 7.3.3');

‎contrib/tsearch2/tsearch.sql._in

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,42 @@ CREATE FUNCTION get_covers(tsvector,tsquery)
666666
language 'C'
667667
with (isstrict);
668668

669+
--debug function
670+
create type tsdebug as (
671+
ts_name text,
672+
tok_type text,
673+
description text,
674+
token text,
675+
dict_name text[],
676+
"tsvector" tsvector
677+
);
678+
679+
create function _get_parser_from_curcfg()
680+
returns text as
681+
' select prs_name from pg_ts_cfg where oid = show_curcfg() '
682+
language 'SQL' with(isstrict,iscachable);
683+
684+
create function ts_debug(text)
685+
returns setof tsdebug as '
686+
select
687+
m.ts_name,
688+
t.alias as tok_type,
689+
t.descr as description,
690+
p.token,
691+
m.dict_name,
692+
strip(to_tsvector(p.token)) as tsvector
693+
from
694+
parse( _get_parser_from_curcfg(), $1 ) as p,
695+
token_type() as t,
696+
pg_ts_cfgmap as m,
697+
pg_ts_cfg as c
698+
where
699+
t.tokid=p.tokid and
700+
t.alias = m.tok_alias and
701+
m.ts_name=c.ts_name and
702+
c.oid=show_curcfg()
703+
' language 'SQL' with(isstrict);
704+
669705

670706
--example of ISpell dictionary
671707
--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;

‎contrib/tsearch2/untsearch.sql.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ DROP TYPE tsquery CASCADE;
2626
DROP TYPE gtsvector CASCADE;
2727
DROP TYPE tsstat CASCADE;
2828
DROP TYPE statinfo CASCADE;
29+
DROP TYPE tsdebug CASCADE;
30+
2931

3032
DROP FUNCTION lexize(oid, text) ;
3133
DROP FUNCTION lexize(text, text);
@@ -58,5 +60,6 @@ DROP FUNCTION gtsvector_picksplit(internal, internal);
5860
DROP FUNCTION gtsvector_union(bytea, internal);
5961
DROP FUNCTION reset_tsearch();
6062
DROP FUNCTION tsearch2() CASCADE;
63+
DROP FUNCTION _get_parser_from_curcfg();
6164

6265
END;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp