[pgsql-jp: 39500] Re: insensitiveな日本語検索
    FKitamura
    fkit.s @ sys238.jp
       
    2008年 7月 14日 (月) 23:32:00 JST
    
    
  
北村です。
>> translateを使う方法でやってみます。
>
> この方法は非常に実装しやすいと思いますが検索速度大丈夫ですか?
関数インデックスを使ったらどうでしょう?
create table test(
id char(4),
name varchar(30)
);
create index test_idx on test
  (translate(name, 'あいうえお', 'アイウエオ'));
\d test
             Table "public.test"
  Column |         Type          | Modifiers
--------+-----------------------+-----------
  id     | character(4)          |
  name   | character varying(30) |
Indexes:
     "test_idx" btree (translate(name::text,
'あいうえお'::text, 'アイウエオ'::text))
================<F.Kitamura>================
He can who thinks he can, and he can't who thinks he can't.
This is an inexorable, indisputable law.
    
    
pgsql-jp メーリングリストの案内