From: | Daniel Staal <DStaal(at)usa(dot)net> |
---|---|
To: | PGSQL-Novice <pgsql-novice(at)postgresql(dot)org> |
Subject: | Text search language field |
Date: | 2012-05-13 00:08:42 |
Message-ID: | 83D1A28F3F422F2F9D8C73BD@mac-pro.magehandbook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
I'm working on project with some large text areas that will need to be
searched, and I'm trying to set up an indexed text search field to make
things a bit smoother. Only one of the top requirements is that this has
to be multi-lingual, so I should be using the correct language's text
search. The table stores the language the text is in, so in theory this
should be easy... But it seems to be a bit more subtle than it first
appears. Any ideas on the best way to set this up?
Tables:
Resource:
"text_element" text,
"text_search" tsvector,
"language" char varying(3) references "languages"
languages (This is 'static' list of ISO 639-3 codes, to make sure
everything uses the same codes):
"code" character varying(3) primary key,
"description" character varying(100)
Trigger (This is my first draft):
create trigger "textsearch_trig" before update or insert
on "resource" for each row execute procedure
tsvector_update_trigger_column("text_search", "language",
"text_element");
The trigger currently throws an error 'column "language" is not of
regconfig type' whenever I try to use it, and I'm looking for the best way
to solve that. The 'simple' solution of 'create text search configuration
eng ( copy = pg_catalog.english );' didn't work. Before I start into a
long exploration into why and what should be done about it, I thought I'd
seek wisdom. ;)
Daniel T. Staal
---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Gavin Flower | 2012-05-13 02:15:36 | Re: Text search language field |
Previous Message | Benjamin Hurt | 2012-05-11 22:51:56 | Update Ordering Using Non-Indexed Fields |