[groonga-dev,03855] PGROONGAの@@コマンドでの前方一致検索

Back to archive index

高見 直輝 takam****@orega*****
2016年 1月 15日 (金) 16:37:34 JST


お世話になります。高見です。
環境
・PostgreSQL9.4.5
・PGROONGA1.0.0

少々特殊な条件指定をやろうとしています。
まずは、テーブル定義から。

CREATE TABLE TEST_TABLE
(
  rootdir character varying(128),
  path text
);
CREATE INDEX TEST_TABLE_path ON TEST_TABLE USING pgroonga (lower(pathcombine(rootdir,path))) WITH (tokenizer='TokenBigramSplitSymbolAlphaDigit', normalizer='');

pathcombine関数は自作の関数で、渡された2つの文字列をトリムし、『\』記号
で連結します。

このテーブルに幾らかのデータが登録されており、
select lower(pathcombine(rootdir::text, path)) as tmp from TEST_TABLE where 
 lower(pathcombine(rootdir,path)) @@ lower('"\\st\\新しいフォルダー\\フォルダ"+"30"')
というSQLを実行したところ、
\st\新しいフォルダー\フォルダ10000個\00001-00100\00030
というレコードがヒットしました。

これに前方一致条件を加えた
select lower(pathcombine(rootdir::text, path)) as tmp from TEST_TABLE where 
 lower(pathcombine(rootdir,path)) @@ lower('"\\st\\新しいフォルダー\\フォルダ"*+"30"')
を実行したところ、今度はレコードが1件もヒットしませんでした。

これは@@の構文が間違っているのでしょうか?
それとも、関数を使用したインデックスでは前方一致に対応していないのでしょうか?

----------------------------- 
高見 直輝 <takam****@orega*****>
株式会社オレガ
TEL:03-3267-0150
FAX:03-3267-0180




groonga-dev メーリングリストの案内
Back to archive index