[groonga-dev,00493] (無題)

Back to archive index

Endo Akira endo4****@goo*****
2011年 4月 10日 (日) 13:04:48 JST


遠藤です。

referenceのvectorを作っての検索ですが、下記ではうまくいかない
ようです。

Groonga::Database.create(path: "db1/db")
Groonga::Schema.create_table("prods", type: :hash) do |table|
  table.short_text("name")
end
Groonga::Schema.create_table("items", type: :hash) do |table|
  table.reference("prods_ref", "prods", type: :vector)
end
prods = Groonga["prods"]
items = Groonga["items"]
p1 = prods.add('1',name: 'first')
p2 = prods.add('2',name: 'second')
items.add('1',prods_ref: [p1,p2])
p items.select{|r| r.prods_ref.name =~ 'first'}.size #=> 1
p items.select{|r| r.prods_ref.name =~ 'second'}.size #=> 0

普通のvectorだと全部探してくれるのですが。




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