From: | Teodor Sigaev <teodor(at)sigaev(dot)ru> |
---|---|
To: | Albert Chern <albert(dot)chern(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Prefix search on all hstore values |
Date: | 2013-11-28 08:44:11 |
Message-ID: | 5297025B.7000605@sigaev.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi!
Full-text search has this feature.
# select to_tsvector('en_name=>yes, fr_name=>oui'::hstore::text) @@ 'en:*';
?column?
----------
t
or (index only keys)
select to_tsvector(akeys('en_name=>yes, fr_name=>oui'::hstore)::text) @@ 'en:*';
?column?
----------
t
To speed up this queries you use functional indexes.
Albert Chern wrote:
> Hi,
>
> I have an hstore column that stores a string in several arbitrary languages, so
> something like this:
>
> "en" => "string in english", "zh" => "string in chinese", "fr" => "string in french"
>
> Is it possible to construct an index that can be used to determine if a query
> string is a prefix of ANY of the values in the hstore? From reading the
> documentation the closest I've gotten is a gin index after converting the values
> to an array, but that doesn't seem to work with prefix searching. Any pointers
> would be much appreciated!
>
> Thanks,
> Albert
--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/
From | Date | Subject | |
---|---|---|---|
Next Message | Sergey Konoplev | 2013-11-28 08:51:44 | Re: Prefix search on all hstore values |
Previous Message | Sergey Konoplev | 2013-11-28 08:38:15 | Re: Prefix search on all hstore values |