From d321421d0a409ee4473c996fd2275df0ff215eaf Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 22 Aug 2007 01:39:46 +0000 Subject: Simplify the syntax of CREATE/ALTER TEXT SEARCH DICTIONARY by treating the init options of the template as top-level options in the syntax. This also makes ALTER a bit easier to use, since options can be replaced individually. I also made these statements verify that the tmplinit method will accept the new settings before they get stored; in the original coding you didn't find out about mistakes until the dictionary got invoked. Under the hood, init methods now get options as a List of DefElem instead of a raw text string --- that lets tsearch use existing options-pushing code instead of duplicating functionality. --- doc/src/sgml/ref/alter_tsdictionary.sgml | 46 ++++++++++++++++++++++++------- doc/src/sgml/ref/create_tsdictionary.sgml | 43 ++++++++++++++++++++++++----- 2 files changed, 72 insertions(+), 17 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/alter_tsdictionary.sgml b/doc/src/sgml/ref/alter_tsdictionary.sgml index 59c33666557..a2929c70d12 100644 --- a/doc/src/sgml/ref/alter_tsdictionary.sgml +++ b/doc/src/sgml/ref/alter_tsdictionary.sgml @@ -1,5 +1,5 @@ @@ -20,7 +20,9 @@ PostgreSQL documentation -ALTER TEXT SEARCH DICTIONARY name ( OPTION = init_options ) +ALTER TEXT SEARCH DICTIONARY name ( + option [ = value ] [, ... ] +) ALTER TEXT SEARCH DICTIONARY name RENAME TO newname ALTER TEXT SEARCH DICTIONARY name OWNER TO newowner @@ -31,8 +33,8 @@ ALTER TEXT SEARCH DICTIONARY name OWNER TO ALTER TEXT SEARCH DICTIONARY changes the definition of - a text search dictionary. You can change the dictionary's initialization - options, or change the dictionary's name or owner. + a text search dictionary. You can change the dictionary's + template-specific options, or change the dictionary's name or owner. @@ -56,11 +58,22 @@ ALTER TEXT SEARCH DICTIONARY name OWNER TO - init_options + option - A new list of initialization options, or NULL to - remove all options. + The name of a template-specific option to be set for this dictionary. + + + + + + value + + + The new value to use for a template-specific option. + If the equal sign and value are omitted, then any previous + setting for the option is removed from the dictionary, + allowing the default to be used. @@ -83,18 +96,31 @@ ALTER TEXT SEARCH DICTIONARY name OWNER TO + + + Template-specific options can appear in any order. + Examples - The following example command sets the language and stopword list - for a Snowball-based dictionary. + The following example command changes the stopword list + for a Snowball-based dictionary. Other parameters remain unchanged. + + + +ALTER TEXT SEARCH DICTIONARY my_dict ( StopWords = newrussian ); + + + + The following example command changes the language option to dutch, + and removes the stopword option entirely. -ALTER TEXT SEARCH DICTIONARY my_russian ( option = 'Language=russian, StopWords=my_russian' ); +ALTER TEXT SEARCH DICTIONARY my_dict ( language = dutch, StopWords ); diff --git a/doc/src/sgml/ref/create_tsdictionary.sgml b/doc/src/sgml/ref/create_tsdictionary.sgml index 81c6a0c6edb..9aa53a6a7c4 100644 --- a/doc/src/sgml/ref/create_tsdictionary.sgml +++ b/doc/src/sgml/ref/create_tsdictionary.sgml @@ -1,5 +1,5 @@ @@ -22,7 +22,7 @@ PostgreSQL documentation CREATE TEXT SEARCH DICTIONARY name ( TEMPLATE = template - [, OPTION = init_options ] + [, option = value [, ... ]] ) @@ -78,17 +78,46 @@ CREATE TEXT SEARCH DICTIONARY name - init_options + option - A list of initialization options for the template functions. - This is a string containing keyword = - value pairs. The specific keywords allowed - vary depending on the text search template. + The name of a template-specific option to be set for this dictionary. + + + + + + value + + + The value to use for a template-specific option. If the value + is not a simple identifier or number, it must be quoted (but you can + always quote it, if you wish). + + + The options can appear in any order. + + + + + Examples + + + The following example command creates a Snowball-based dictionary + with a nonstandard list of stop words. + + + +CREATE TEXT SEARCH DICTIONARY my_russian ( + template = snowball, + language = russian, + stopwords = myrussian +); + -- cgit v1.2.3