Re: Case sensitive full text searching

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: "Fco(dot) Mario Barcala =?ISO-8859-1?Q?Rodr=EDguez?=" <lbarcala(at)freeresearch(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Case sensitive full text searching
Date: 2008-09-03 17:10:55
Message-ID: Pine.LNX.4.64.0809032102480.1801@sn.sai.msu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 3 Sep 2008, Fco. Mario Barcala Rodr?guez wrote:

> Hi all:
>
> Is there any way to create a case sensitive full text index? My target
> is to make case sensitive full text searches but I don't know how.
>
> I could create a configurario for full text searching:
>
> CREATE TEXT SEARCH CONFIGURATION public.myconfiguration (PARSER =
> pg_catalog.default);
>
> CREATE TEXT SEARCH DICTIONARY public.my_dict (
> TEMPLATE = pg_catalog.simple,
> STOPWORDS = my_stops
> );
>
> ALTER TEXT SEARCH CONFIGURATION myconfiguration
> ALTER MAPPING FOR asciiword, asciihword, hword_asciipart,
> word, hword, hword_part
> WITH my_dict;
>
> And then create the full text index:
>
> CREATE INDEX textindexsensible ON documento
> USING gin(to_tsvector('myconfiguration',texto));
>
> But default behaviour of Simple Dictionary returns the lower-cased form
> of the word if it isn't in stopwords list. Is there any way to change
> this behaviour?

If you don't need any dictionary, why do you use simple dictionary ?
Instead, you can write dummy dictionary, which just checks for stopwords.
Another option, is write simple wrapper around simple dictionary, which
returns array (lexem_from_simple_dic, original_lexem). Then you can
have two different configurations - one for case sensitive search
(uses this wrapper dictionary for query) and another one - for more broader
search.

Looks like we can take this into account in our future work on improving
flexibility of text search.

Oleg

>
> Thanks in advance,
>
> Mario Barcala
>
> P.S. I am using PostgreSQL 8.3
>
>
>

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

In response to

Browse pgsql-general by date

  From Date Subject
Next Message William Garrison 2008-09-03 17:17:53 Simple query not using index: why?
Previous Message Alvaro Herrera 2008-09-03 16:59:42 Re: Backslash Escape Sequences