How does the tsearch configuration get selected?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paesold <mpaesold(at)gmx(dot)at>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Gregory Stark <stark(at)enterprisedb(dot)com>, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Teodor Sigaev <teodor(at)sigaev(dot)ru>, pgsql-hackers(at)postgresql(dot)org
Subject: How does the tsearch configuration get selected?
Date: 2007-06-15 02:52:24
Message-ID: 200706150252.l5F2qOv06843@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy pgsql-hackers

I am confused by the CREATE FULLTEXT CONFIGURATION command:

http://momjian.us/expire/fulltext/SGML/ref/create-fulltext-config.sgml

First, why are we specifying the server locale here since it never
changes:

<varlistentry>
<term><literal>LOCALE</literal></term>
<listitem>
<para>
<replaceable class="PARAMETER">localename</replaceable>
is the name of the locale. It should match server's locale (<varname>lc_ctype</varname>)
to identify full-text configuration used by default.
</para>
</listitem>
</varlistentry>

Second, I can't figure out how to reference a non-default
configuration. The description says:

<varlistentry>
<term><LITERAL>AS DEFAULT</LITERAL></term>
<listitem>
<para>
Set <literal>default</literal> flag for the configuration, which
used to identify if this configuration is selectable on default
(see <LITERAL>LOCALE</LITERAL> description above).
It is possible to have <emphasis>maximum one</emphasis> configuration
with the same locale and in the same schema with this flag enabled.
</para>
</listitem>
</varlistentry>

The documentation says that the first fulltext configuration found in
the search patch is the one used, so how does a secondary configuration
in the same schema actually get accessed by @@ or ::tsquery? Do you
have to use to_tsquery() with the optional configuration name?

Is this really the direction we want to go, having a default that gets
picked up from the search_path, perhaps based on some encoding/locale
match I can't figure out, or do we want to require the configuration to
be specified always, and if we do that, how do we handle the @@
operator?

I am thinking we should just have use the first fulltext configuration
from the first schema in the search path and eliminate naming the
configurations (same as schema name?). Allowing configuration names to
be specified only sometimes is confusing. Or we can use a GUC to name
the configuration we want to use specifically, rather than have a
read-only tsearch_conf_name (is it read-only?) that is controlled by the
search_path.

And why are we talking locale here instead of encoding? And since we
only have one encoding per database, how can there be more than one? Is
this _client_ encoding?

FYI, while the configuration selection needs work, the rest of the areas
seem logical.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-advocacy by date

  From Date Subject
Next Message Tom Lane 2007-06-15 03:39:35 Re: How does the tsearch configuration get selected?
Previous Message Teodor Sigaev 2007-06-14 20:25:49 Re: tsearch_core patch: permissions and security issues

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-06-15 03:39:35 Re: How does the tsearch configuration get selected?
Previous Message Tom Lane 2007-06-15 02:47:55 Re: Tsearch vs Snowball, or what's a source file?