summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTeodor Sigaev2009-08-14 14:53:20 +0000
committerTeodor Sigaev2009-08-14 14:53:20 +0000
commitabd8c94ff98091a5134d905258c2835e72b2dbd8 (patch)
tree52c77ae28850e91e1cd719a425008ed0ab289647 /doc/src
parent0c738084fbb2ef55dfe27702b9486bf44c911a0c (diff)
Add prefix support for synonym dictionary
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/textsearch.sgml59
1 files changed, 58 insertions, 1 deletions
diff --git a/doc/src/sgml/textsearch.sgml b/doc/src/sgml/textsearch.sgml
index 547c0153ac8..ed78c1d10a0 100644
--- a/doc/src/sgml/textsearch.sgml
+++ b/doc/src/sgml/textsearch.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/textsearch.sgml,v 1.52 2009/06/17 21:58:49 tgl Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/textsearch.sgml,v 1.53 2009/08/14 14:53:20 teodor Exp $ -->
<chapter id="textsearch">
<title id="textsearch-title">Full Text Search</title>
@@ -2288,6 +2288,63 @@ SELECT * FROM ts_debug('english', 'Paris');
asciiword | Word, all ASCII | Paris | {my_synonym,english_stem} | my_synonym | {paris}
</programlisting>
</para>
+
+ <para>
+ An asterisk (<literal>*</literal>) at the end of definition word indicates
+ that definition word is a prefix, and <function>to_tsquery()</function>
+ function will transform that definition to the prefix search format (see
+ <xref linkend="textsearch-parsing-queries">).
+ Notice that it is ignored in <function>to_tsvector()</function>.
+ </para>
+
+ <para>
+ Contents of <filename>$SHAREDIR/tsearch_data/synonym_sample.syn</>:
+ </para>
+<programlisting>
+postgres pgsql
+postgresql pgsql
+postgre pgsql
+gogle googl
+indices index*
+</programlisting>
+
+ <para>
+ Results:
+ </para>
+<programlisting>
+=# create text search dictionary syn( template=synonym,synonyms='synonym_sample');
+=# select ts_lexize('syn','indices');
+ ts_lexize
+-----------
+ {index}
+(1 row)
+
+=# create text search configuration tst ( copy=simple);
+=# alter text search configuration tst alter mapping for asciiword with syn;
+=# select to_tsquery('tst','indices');
+ to_tsquery
+------------
+ 'index':*
+(1 row)
+
+=# select 'indexes are very useful'::tsvector;
+ tsvector
+---------------------------------
+ 'are' 'indexes' 'useful' 'very'
+(1 row)
+
+=# select 'indexes are very useful'::tsvector @@ to_tsquery('tst','indices');
+ ?column?
+----------
+ t
+(1 row)
+
+=# select to_tsvector('tst','indices');
+ to_tsvector
+-------------
+ 'index':1
+(1 row)
+</programlisting>
<para>
The only parameter required by the <literal>synonym</> template is