[groonga-dev,00446] Re: ()~:+><-* などの記号を含んだ文字の検索について

Back to archive index

Kouhei Sutou kou****@clear*****
2011年 1月 27日 (木) 18:10:00 JST


須藤です。

In <10164****@nifty*****>
  "[groonga-dev,00445] Re: ()~:+><-* などの記号を含んだ文字の検索について" on Thu, 27 Jan 2011 12:10:58 +0900 (JST),
  佐藤 <yfa02****@nifty*****> wrote:

> いっそ、クォートを含めて渡した文字列をそのままgroongaに渡すオプションがあると
> 良いのかもしれません。
> 
> _query << " --#{key} #{value}"
> 
> みたいなイメージです。

なるほど!

ということで、手元でいろいろパターンを試してみたのですが、
rroonga本体を変更しなくてもこれでいけることがわかりました!

  context.select("Entries",
                 :match_columns => "body",
                 :query => "\"(\"")

ということで、これでいかがでしょうか?

あるいは、便利オプション「:escape_query => true」を追加して、
↓で↑と同じ挙動にしてもいいかとも思いました。

  context.select("Entries",
                 :match_columns => "body",
                 :query => "(",
                 :escape_query => true)

が、:query => "\"("とするとシンタックスエラーになるので微妙
なんですよね。。。


どうしたものかしら。

-- 
須藤 功平 <kou****@clear*****>
株式会社クリアコード <http://www.clear-code.com/> (03-6231-7270)

Mozilla Firefox/Thunderbirdサポート:
  http://www.clear-code.com/services/mozilla/menu.html
迷惑メール対策:
  http://www.clear-code.com/software/milter-manager.html
テスティングフレームワーク:
  http://www.clear-code.com/software/cutter.html
  http://www.clear-code.com/software/uxu.html




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