Re: tsearch2: more than one index per table?

From: "Andrew J(dot) Kopciuch" <akopciuch(at)bddf(dot)ca>
To: "Rick Schumeyer" <rschumeyer(at)ieee(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: tsearch2: more than one index per table?
Date: 2005-11-23 15:21:38
Message-ID: 200511230821.39096.akopciuch@bddf.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday 23 November 2005 06:55, Rick Schumeyer wrote:
> I apologize if I'm being dense, but I'm not completely following the
> explanation. It is true that my pg_ts_cfg.locale is set to en_US.UTF-8.
>
> It was my understanding that specifying "default" as in
>

That takes the locale that is specified in the tsearch2 configuration called
"default";

take a look at this :

ftstest=# select * from pg_ts_cfg;
ts_name | prs_name | locale
-----------------+----------+--------------
default | default | C
default_russian | default | ru_RU.KOI8-R
simple | default |
custom | default |

If you don't have a record in that table that matches the server encoding
(en_US.UTF-8), you need to create a new configuration to use that locale.
That's all describe in the link I sent before.

If you have a configuration you always want to use you can just switch to that
configuration.

If you do something like this :

ftstest=# select set_curcfg('simple');
set_curcfg
------------

(1 row)

ftstest=# select to_tsvector('simple', 'a simple test');
to_tsvector
---------------------------
'a':1 'test':3 'simple':2
(1 row)

ftstest=# select to_tsvector('a simple test');
to_tsvector
---------------------------
'a':1 'test':3 'simple':2
(1 row)

ftstest=# select to_tsvector('default', 'a simple test');
to_tsvector
--------------------
'test':3 'simpl':2
(1 row)

The second example does not specify a configuration, but because you set in
the set_curcfg statement it knows to use the "simple" configuration.

> UPDATE t SET idxB=to_tsvector('default', b);
>

This forces a configuration called "default"

> UPDATE t SET idxB=to_tsvector(b); -- no 'default'
>

This doesn't tell it which configuration to use, so it tries to find one that
matches your locale (en_US.UTF-8). There probably isn't one in pg_ts_cfg, so
it gives the error.

hth,

Andy

In response to

Browse pgsql-general by date

  From Date Subject
Next Message codeWarrior 2005-11-23 15:57:00 Re: Strugging with NEW and OLD records.
Previous Message Andrus 2005-11-23 15:01:49 Re: Why pgAdmin III guru suggests VACUUM in 8.1