Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
select: add drilldowns[LABEL].adjuster
- Loading branch information
Showing
4 changed files
with
274 additions
and
0 deletions.
There are no files selected for viewing
90 changes: 90 additions & 0 deletions
90
test/command/suite/select/drilldowns/adjuster/filter.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
99 changes: 99 additions & 0 deletions
99
test/command/suite/select/drilldowns/adjuster/no_filter.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
42 changes: 42 additions & 0 deletions
42
test/command/suite/select/drilldowns/adjuster/no_filter.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |