Skip to content

Commit d702313

Browse files
committed
Add documentation about ts_debug
1 parent dd2870f commit d702313

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

contrib/tsearch2/docs/tsearch2-ref.html

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,33 @@ <h2><a name="configurations">Configurations</a></h2>
216216
stopping either with the first one to return a lexeme for the token,
217217
or discarding the token if no dictionary returns a lexeme for it.
218218

219-
<h2><a name="dictionaries">Parsers</a></h2>
219+
<h2><a name="testing">Testing</a></h2>
220+
221+
Function <tt>ts_debug</tt> allows easy testing of your <b>current</b> configuration.
222+
You may always test another configuration using <tt>set_curcfg</tt> function.
223+
<p>
224+
Example:
225+
</p><pre>apod=# select * from ts_debug('Tsearch module for PostgreSQL 7.3.3');
226+
ts_name | tok_type | description | token | dict_name | tsvector
227+
---------+----------+-------------+------------+-----------+--------------
228+
default | lword | Latin word | Tsearch | {en_stem} | 'tsearch'
229+
default | lword | Latin word | module | {en_stem} | 'modul'
230+
default | lword | Latin word | for | {en_stem} |
231+
default | lword | Latin word | PostgreSQL | {en_stem} | 'postgresql'
232+
default | version | VERSION | 7.3.3 | {simple} | '7.3.3'
233+
</pre>
234+
Here:
235+
<br>
236+
<ul>
237+
<li>tsname - configuration name
238+
</li><li>tok_type - token type
239+
</li><li>description - human readable name of tok_type
240+
</li><li>token - parser's token
241+
</li><li>dict_name - dictionary used for the token
242+
</li><li>tsvector - final result</li></ul>
243+
244+
245+
<h2><a name="parsers">Parsers</a></h2>
220246

221247
Each parser is defined by a record in the <tt>pg_ts_parser</tt> table:
222248

@@ -261,33 +287,6 @@ <h2><a name="dictionaries">Parsers</a></h2>
261287
which the parser will label each token of that type,
262288
the <tt>alias</tt> which names the token type,
263289
and a short description <tt>descr</tt> for the user to read.
264-
<br>
265-
Example:
266-
<br>
267-
<pre> apod=# select m.ts_name, t.alias as tok_type, t.descr as description, p.token,\
268-
apod=# m.dict_name, strip(to_tsvector(p.token)) as tsvector\
269-
apod=# from parse('Tsearch module for PostgreSQL 7.3.3') as\
270-
apod=# p, token_type() as t, pg_ts_cfgmap as m, pg_ts_cfg as c\
271-
apod=# where t.tokid=p.tokid and t.alias = m.tok_alias\
272-
apod=# and m.ts_name=c.ts_name and c.oid=show_curcfg();
273-
ts_name | tok_type | description | token | dict_name | tsvector
274-
---------+----------+-------------+------------+-----------+--------------
275-
default | lword | Latin word | Tsearch | {en_stem} | 'tsearch'
276-
default | word | Word | module | {simple} | 'modul'
277-
default | lword | Latin word | for | {en_stem} |
278-
default | lword | Latin word | PostgreSQL | {en_stem} | 'postgresql'
279-
default | version | VERSION | 7.3.3 | {simple} | '7.3.3'
280-
</pre>
281-
Here:
282-
<ul>
283-
<li> tsname - configuration name
284-
</li><li> tok_type - token type
285-
</li><li> description - human readable name of tok_type
286-
</li><li> token - parser's token
287-
</li><li> dict_name - dictionary will be used for the token
288-
</li><li> tsvector - final result
289-
</li></ul>
290-
291290
</dd><dt>
292291
<tt>CREATE FUNCTION parse(
293292
<em>[</em> <i>parser</i>, <em>]</em> <i>document</i> TEXT

0 commit comments

Comments
 (0)