A couple PostgreSQL 8.3 related Fulltext-Search questions

From: "Oliver Weichhold" <oliver(at)weichhold(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: A couple PostgreSQL 8.3 related Fulltext-Search questions
Date: 2008-02-12 20:27:28
Message-ID: a13da490802121227jd28bbf4k85c26e447b4447f2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This is my table:

CREATE TABLE item_names
(
item_name character varying(255) NOT NULL,
culture_id integer NOT NULL,
item_id integer NOT NULL,
ft_idx_config regconfig,
CONSTRAINT pk_item_names PRIMARY KEY (item_id, culture_id)
)

Basically the table stores strings with varying language (actually en, de,
fr, es) in the item_name column and implements the language association
using the culture_id column. I would like to run fulltext queries against
item_name + culture_id. The ft_idx_config shall be used to provide the
appropriate ts_vector config for culture_id.

Question 1: The manual mentions (
http://www.postgresql.org/docs/8.3/interactive/textsearch-tables.html) that
there's an alternative method to create a GIN index.

<quote>

"It is possible to set up more complex expression indexes wherein the
configuration name is specified by another column, e.g.:

CREATE INDEX pgweb_idx ON pgweb USING gin(to_tsvector(config_name, body));

</quote>

A little further down it is also mentioned that indexes can even concatenate
columns. Unfortunately I do not seem to be able combine both forms into:

CREATE INDEX ft_idx_item_name ON item_names USING
gin(to_tsvector(ft_idx_config, item_name || culture_id));

Which, unless I am mistaken, I would need to execute a fulltext query for a
specific language. Is there a way to solve this or do I need to change my
table layout?

Question 2: When trying to insert rows into this table (using IBatis):

INSERT INTO item_names (item_id, item_name, ft_idx_config, culture_id)
VALUES(#item_id#, #item_name#, #ft_idx_config#, #culture_id# )

I'm receiving this error: ERROR: column "ft_idx_config" is of type regconfig
but expression is of type character varying

Do I have to cast the parameter?

Browse pgsql-general by date

  From Date Subject
Next Message Nathan Wilhelmi 2008-02-12 20:48:46 Re: Deferred constraints and locks...
Previous Message Robert Treat 2008-02-12 20:13:05 Re: TSearch2 Migration Guide from 8.2 to 8.3