[pgsql-jp: 38000] Re: [tsearch2]日本語のストップワード
Tatsuo Ishii
ishii @ sraoss.co.jp
2007年 2月 10日 (土) 18:08:00 JST
石井です.
> 日本語のストップワードを有効にするには「--locale=ja_JP.UTF8」でデータ
> ベースクラスタの作成するしかないのでしょうか?(「--no-locale」で作成
> した場合は日本語のストップワードは使用できないのでしょうか?)
--no-localeでも日本語のストップワードを使えるようにするパッチを作って
みました.8.2.3用です. share/contrib/english.stop に日本語のストップ
ワードを登録してみましたが,使えるようになったようです.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
*** wordparser/parser.c~ 2007-01-16 00:16:11.000000000 +0900
--- wordparser/parser.c 2007-02-10 18:04:59.000000000 +0900
***************
*** 246,251 ****
--- 246,266 ----
static int
p_islatin(TParser * prs)
{
+ if (prs->usewide)
+ {
+ if (lc_ctype_is_c())
+ {
+ unsigned int c = *(unsigned int*)(prs->wstr + prs->state->poschar);
+
+ /*
+ * any non-ascii symbol with multibyte encoding
+ * with C-locale is a latin character
+ */
+ if ( c > 0x7f )
+ return 1;
+ }
+ }
+
return (p_isalpha(prs) && p_isascii(prs)) ? 1 : 0;
}
pgsql-jp メーリングリストの案内