こんにちは、堀本です。
Groonga 12.0.5 をリリースしました!
https://groonga.org/ja/docs/news.html#release-12-0-5
変更点一覧:
https://groonga.org/ja/blog/2022/06/29/groonga-12.0.5.html
## 主な変更内容
主な変更点は以下の通りです。
### 改良
* [select] 検索エスカレーションによる前方一致検索のパフォーマンスを少し改善しました。
* [select] drilldowns[LABEL]._key に重み付き参照ベクターカラムを指定できるようになりました。
今までは、ドリルダウンのキーに重み付き参照ベクターカラムを指定すると、Groongaが誤った結果を返していました。
例えば、以下のタグ検索は、今まで誤った結果を返していました。
table_create Tags TABLE_PAT_KEY ShortText
table_create Memos TABLE_HASH_KEY ShortText
column_create Memos tags COLUMN_VECTOR|WITH_WEIGHT Tags
column_create Memos date COLUMN_SCALAR Time
load --table Memos
[
{"_key": "Groonga is fast!", "tags": {"full-text-search": 100}, "date": "2014-11-16 00:00:00"},
{"_key": "Mroonga is fast!", "tags": {"mysql": 100, "full-text-search": 80}, "date": "2014-11-16 00:00:00"},
{"_key": "Groonga sticker!", "tags": {"full-text-search": 100, "sticker": 10}, "date": "2014-11-16 00:00:00"},
{"_key": "Rroonga is fast!", "tags": {"full-text-search": 100, "ruby": 20}, "date": "2014-11-17 00:00:00"},
{"_key": "Groonga is good!", "tags": {"full-text-search": 100}, "date": "2014-11-17 00:00:00"}
]
select Memos \
--drilldowns[tags].keys tags \
--drilldowns[tags].output_columns _key,_nsubrecs
[
[
0,
1656480220.591901,
0.0005342960357666016
],
[
[
[
5
],
[
[
"_id",
"UInt32"
],
[
"_key",
"ShortText"
],
[
"date",
"Time"
],
[
"tags",
"Tags"
]
],
[
1,
"Groonga is fast!",
1416063600.0,
{"full-text-search":100}
],
[
2,
"Mroonga is fast!",
1416063600.0,
{"mysql":100,"full-text-search":80}
],
[
3,
"Groonga sticker!",
1416063600.0,
{"full-text-search":100,"sticker":10}
],
[
4,
"Rroonga is fast!",
1416150000.0,
{"full-text-search":100,"ruby":20}
],
[
5,
"Groonga is good!",
1416150000.0,
{"full-text-search":100}
]
],
{
"tags": [
[
8
],
[
[
"_key",
"ShortText"
],
[
"_nsubrecs",
"Int32"
]
],
[
"full-text-search",
5
],
[
"f",
5
],
[
"mysql",
1
],
[
"f",
1
],
[
"sticker",
1
],
[
"f",
1
],
[
"ruby",
1
],
[
"f",
1
]
]
}
]
]
今回のリリースから上記のクエリーは、以下のように正しい結果を返します。
select Memos --drilldowns[tags].keys tags --drilldowns[tags].output_columns _key,_nsubrecs
[
[
0,
0.0,
0.0
],
[
[
[
5
],
[
[
"_id",
"UInt32"
],
[
"_key",
"ShortText"
],
[
"date",
"Time"
],
[
"tags",
"Tags"
]
],
[
1,
"Groonga is fast!",
1416063600.0,
{
"full-text-search": 100
}
],
[
2,
"Mroonga is fast!",
1416063600.0,
{
"mysql": 100,
"full-text-search": 80
}
],
[
3,
"Groonga sticker!",
1416063600.0,
{
"full-text-search": 100,
"sticker": 10
}
],
[
4,
"Rroonga is fast!",
1416150000.0,
{
"full-text-search": 100,
"ruby": 20
}
],
[
5,
"Groonga is good!",
1416150000.0,
{
"full-text-search": 100
}
]
],
{
"tags": [
[
4
],
[
[
"_key",
"ShortText"
],
[
"_nsubrecs",
"Int32"
]
],
[
"full-text-search",
5
],
[
"mysql",
1
],
[
"sticker",
1
],
[
"ruby",
1
]
]
}
]
]
* [select] query や filter や post_filter を使っていても、ドリルダウンのキーに重み付き参照ベクターカラムを指定できるようになりました。
今までは、 query や filter や post_filter を使っているときに、ドリルダウンのキーに重み付き参照ベクターカラムを指定すると
Groongaは誤った結果、またはエラーを返していました。
例えば、今まで以下のクエリーはエラーを返していました。
table_create Tags TABLE_PAT_KEY ShortText
table_create Memos TABLE_HASH_KEY ShortText
column_create Memos tags COLUMN_VECTOR|WITH_WEIGHT Tags
column_create Memos date COLUMN_SCALAR Time
load --table Memos
[
{"_key": "Groonga is fast!", "tags": {"full-text-search": 100}, "date": "2014-11-16 00:00:00"},
{"_key": "Mroonga is fast!", "tags": {"mysql": 100, "full-text-search": 80}, "date": "2014-11-16 00:00:00"},
{"_key": "Groonga sticker!", "tags": {"full-text-search": 100, "sticker": 10}, "date": "2014-11-16 00:00:00"},
{"_key": "Rroonga is fast!", "tags": {"full-text-search": 100, "ruby": 20}, "date": "2014-11-17 00:00:00"},
{"_key": "Groonga is good!", "tags": {"full-text-search": 100}, "date": "2014-11-17 00:00:00"}
]
select Memos \
--filter true \
--post_filter true \
--drilldowns[tags].keys tags \
--drilldowns[tags].output_columns _key,_nsubrecs
[
[
-22,
1656473820.734894,
0.03771400451660156,
"[hash][add][ ] key size unmatch",
[
[
"grn_hash_add",
"hash.c",
3405
]
]
],
[
[
]
]
]
今回のリリースから上記のクエリーは、以下のように正しい結果を返します。
select Memos \
--filter true \
--post_filter true \
--drilldowns[tags].keys tags \
--drilldowns[tags].output_columns _key,_nsubrecs
[
[
0,
0.0,
0.0
],
[
[
[
5
],
[
[
"_id",
"UInt32"
],
[
"_key",
"ShortText"
],
[
"date",
"Time"
],
[
"tags",
"Tags"
]
],
[
1,
"Groonga is fast!",
1416063600.0,
{
"full-text-search": 100
}
],
[
2,
"Mroonga is fast!",
1416063600.0,
{
"mysql": 100,
"full-text-search": 80
}
],
[
3,
"Groonga sticker!",
1416063600.0,
{
"full-text-search": 100,
"sticker": 10
}
],
[
4,
"Rroonga is fast!",
1416150000.0,
{
"full-text-search": 100,
"ruby": 20
}
],
[
5,
"Groonga is good!",
1416150000.0,
{
"full-text-search": 100
}
]
],
{
"tags": [
[
4
],
[
[
"_key",
"ShortText"
],
[
"_nsubrecs",
"Int32"
]
],
[
"full-text-search",
5
],
[
"mysql",
1
],
[
"sticker",
1
],
[
"ruby",
1
]
]
}
]
]
### 既知の問題
* 現在Groongaには、ベクターカラムに対してデータを大量に追加、削除、更新した際にデータが破損することがある問題があります。
* *< と *> は、filter条件の右辺に query() を使う時のみ有効です。もし、以下のように指定した場合、 *< と *> は && として機能します。
'content @ "Groonga" *< content @ "Mroonga"'
* GRN_II_CURSOR_SET_MIN_ENABLE が原因でマッチするはずのレコードを返さないことがあります。