Kouhei Sutou
null+****@clear*****
Thu Feb 1 11:04:34 JST 2018
Kouhei Sutou 2018-02-01 11:04:34 +0900 (Thu, 01 Feb 2018) New Revision: e21d1e2ecf319933c0f762b30af8cc4d9f8a62e6 https://github.com/groonga/groonga/commit/e21d1e2ecf319933c0f762b30af8cc4d9f8a62e6 Message: select: add drilldowns[LABEL].adjuster Added files: test/command/suite/select/drilldowns/adjuster/filter.expected test/command/suite/select/drilldowns/adjuster/filter.test test/command/suite/select/drilldowns/adjuster/no_filter.expected test/command/suite/select/drilldowns/adjuster/no_filter.test Added: test/command/suite/select/drilldowns/adjuster/filter.expected (+90 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/drilldowns/adjuster/filter.expected 2018-02-01 11:04:34 +0900 (0c7dc3c3e) @@ -0,0 +1,90 @@ +table_create Categories TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +table_create Tags TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Tags categories COLUMN_VECTOR|WITH_WEIGHT Categories +[[0,0.0,0.0],true] +table_create Memos TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos tags COLUMN_VECTOR Tags +[[0,0.0,0.0],true] +column_create Categories tags_categories COLUMN_INDEX|WITH_WEIGHT Tags categories +[[0,0.0,0.0],true] +load --table Tags +[ +{"_key": "groonga", "categories": {"full-text-search": 100}}, +{"_key": "mroonga", "categories": {"mysql": 100, "full-text-search": 80}}, +{"_key": "ruby", "categories": {"language": 100}} +] +[[0,0.0,0.0],3] +load --table Memos +[ +{ + "_key": "Groonga is fast", + "tags": ["groonga"] +}, +{ + "_key": "Mroonga is also fast", + "tags": ["mroonga", "groonga"] +}, +{ + "_key": "Ruby is an object oriented script language", + "tags": ["ruby"] +} +] +[[0,0.0,0.0],3] +select Memos --limit 0 --output_columns _id --drilldowns[groonga_tag].keys tags --drilldowns[groonga_tag].filter '_key == "groonga"' --drilldowns[groonga_tag].adjuster 'categories @ "full-text-search" * 2 + categories @ "mysql"' --drilldowns[groonga_tag].output_columns _key,_nsubrecs,_score +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 3 + ], + [ + [ + "_id", + "UInt32" + ] + ] + ], + { + "groonga_tag": [ + [ + 1 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "_nsubrecs", + "Int32" + ], + [ + "_score", + "Int32" + ] + ], + [ + "groonga", + 2, + 204 + ] + ] + } + ] +] +#>select --drilldowns[groonga_tag].adjuster "categories @ \"full-text-search\" * 2 + categories @ \"mysql\"" --drilldowns[groonga_tag].filter "_key == \"groonga\"" --drilldowns[groonga_tag].keys "tags" --drilldowns[groonga_tag].output_columns "_key,_nsubrecs,_score" --limit "0" --output_columns "_id" --table "Memos" +#:000000000000000 select(3) +#:000000000000000 filter(1) +#:000000000000000 drilldowns[groonga_tag].adjust(1) +#:000000000000000 drilldowns[groonga_tag](1) +#:000000000000000 output(0) +#:000000000000000 output.drilldowns[groonga_tag](1) +#<000000000000000 rc=0 Added: test/command/suite/select/drilldowns/adjuster/filter.test (+43 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/drilldowns/adjuster/filter.test 2018-02-01 11:04:34 +0900 (d64f2af9d) @@ -0,0 +1,43 @@ +table_create Categories TABLE_PAT_KEY ShortText + +table_create Tags TABLE_PAT_KEY ShortText +column_create Tags categories COLUMN_VECTOR|WITH_WEIGHT Categories + +table_create Memos TABLE_HASH_KEY ShortText +column_create Memos tags COLUMN_VECTOR Tags + +column_create Categories tags_categories COLUMN_INDEX|WITH_WEIGHT \ + Tags categories + +load --table Tags +[ +{"_key": "groonga", "categories": {"full-text-search": 100}}, +{"_key": "mroonga", "categories": {"mysql": 100, "full-text-search": 80}}, +{"_key": "ruby", "categories": {"language": 100}} +] + +load --table Memos +[ +{ + "_key": "Groonga is fast", + "tags": ["groonga"] +}, +{ + "_key": "Mroonga is also fast", + "tags": ["mroonga", "groonga"] +}, +{ + "_key": "Ruby is an object oriented script language", + "tags": ["ruby"] +} +] + +#@collect-query-log true +select Memos \ + --limit 0 \ + --output_columns _id \ + --drilldowns[groonga_tag].keys tags \ + --drilldowns[groonga_tag].filter '_key == "groonga"' \ + --drilldowns[groonga_tag].adjuster 'categories @ "full-text-search" * 2 + categories @ "mysql"' \ + --drilldowns[groonga_tag].output_columns _key,_nsubrecs,_score +#@collect-query-log false Added: test/command/suite/select/drilldowns/adjuster/no_filter.expected (+99 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/drilldowns/adjuster/no_filter.expected 2018-02-01 11:04:34 +0900 (79eee87d2) @@ -0,0 +1,99 @@ +table_create Categories TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +table_create Tags TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Tags categories COLUMN_VECTOR|WITH_WEIGHT Categories +[[0,0.0,0.0],true] +table_create Memos TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Memos tags COLUMN_VECTOR Tags +[[0,0.0,0.0],true] +column_create Categories tags_categories COLUMN_INDEX|WITH_WEIGHT Tags categories +[[0,0.0,0.0],true] +load --table Tags +[ +{"_key": "groonga", "categories": {"full-text-search": 100}}, +{"_key": "mroonga", "categories": {"mysql": 100, "full-text-search": 80}}, +{"_key": "ruby", "categories": {"language": 100}} +] +[[0,0.0,0.0],3] +load --table Memos +[ +{ + "_key": "Groonga is fast", + "tags": ["groonga"] +}, +{ + "_key": "Mroonga is also fast", + "tags": ["mroonga", "groonga"] +}, +{ + "_key": "Ruby is an object oriented script language", + "tags": ["ruby"] +} +] +[[0,0.0,0.0],3] +select Memos --limit 0 --output_columns _id --drilldowns[tags].keys tags --drilldowns[tags].adjuster 'categories @ "full-text-search" * 2 + categories @ "mysql"' --drilldowns[tags].output_columns _key,_nsubrecs,_score +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 3 + ], + [ + [ + "_id", + "UInt32" + ] + ] + ], + { + "tags": [ + [ + 3 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "_nsubrecs", + "Int32" + ], + [ + "_score", + "Int32" + ] + ], + [ + "groonga", + 2, + 203 + ], + [ + "mroonga", + 1, + 265 + ], + [ + "ruby", + 1, + 0 + ] + ] + } + ] +] +#>select --drilldowns[tags].adjuster "categories @ \"full-text-search\" * 2 + categories @ \"mysql\"" --drilldowns[tags].keys "tags" --drilldowns[tags].output_columns "_key,_nsubrecs,_score" --limit "0" --output_columns "_id" --table "Memos" +#:000000000000000 select(3) +#:000000000000000 drilldowns[tags].adjust(3) +#:000000000000000 drilldowns[tags](3) +#:000000000000000 output(0) +#:000000000000000 output.drilldowns[tags](3) +#<000000000000000 rc=0 Added: test/command/suite/select/drilldowns/adjuster/no_filter.test (+42 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/drilldowns/adjuster/no_filter.test 2018-02-01 11:04:34 +0900 (cd86987a5) @@ -0,0 +1,42 @@ +table_create Categories TABLE_PAT_KEY ShortText + +table_create Tags TABLE_PAT_KEY ShortText +column_create Tags categories COLUMN_VECTOR|WITH_WEIGHT Categories + +table_create Memos TABLE_HASH_KEY ShortText +column_create Memos tags COLUMN_VECTOR Tags + +column_create Categories tags_categories COLUMN_INDEX|WITH_WEIGHT \ + Tags categories + +load --table Tags +[ +{"_key": "groonga", "categories": {"full-text-search": 100}}, +{"_key": "mroonga", "categories": {"mysql": 100, "full-text-search": 80}}, +{"_key": "ruby", "categories": {"language": 100}} +] + +load --table Memos +[ +{ + "_key": "Groonga is fast", + "tags": ["groonga"] +}, +{ + "_key": "Mroonga is also fast", + "tags": ["mroonga", "groonga"] +}, +{ + "_key": "Ruby is an object oriented script language", + "tags": ["ruby"] +} +] + +#@collect-query-log true +select Memos \ + --limit 0 \ + --output_columns _id \ + --drilldowns[tags].keys tags \ + --drilldowns[tags].adjuster 'categories @ "full-text-search" * 2 + categories @ "mysql"' \ + --drilldowns[tags].output_columns _key,_nsubrecs,_score +#@collect-query-log false -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180201/c97d6f17/attachment-0001.htm