Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support "_nsubrecs" source with "groupBy" and "sortBy"
- Loading branch information
Showing
4 changed files
with
153 additions
and
1 deletion.
There are no files selected for viewing
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
33 changes: 33 additions & 0 deletions
33
test/command/suite/search/group/subrecord/with-sort.catalog.json
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,33 @@ | ||
{ | ||
"datasets": { | ||
"Droonga": { | ||
"fact": "Comments", | ||
"schema": { | ||
"Threads": { | ||
"type": "Hash", | ||
"keyType": "ShortText", | ||
"columns": { | ||
"name": { | ||
"type": "Scalar", | ||
"valueType": "ShortText" | ||
} | ||
} | ||
}, | ||
"Comments": { | ||
"type": "Hash", | ||
"keyType": "ShortText", | ||
"columns": { | ||
"thread": { | ||
"type": "Scalar", | ||
"valueType": "Threads" | ||
}, | ||
"content": { | ||
"type": "Scalar", | ||
"valueType": "Text" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
test/command/suite/search/group/subrecord/with-sort.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,34 @@ | ||
[ | ||
"droonga.message", | ||
0, | ||
{ | ||
"inReplyTo": "request-id", | ||
"statusCode": 200, | ||
"type": "search.result", | ||
"body": { | ||
"comments": { | ||
"count": 2, | ||
"records": [ | ||
[ | ||
"groonga", | ||
1, | ||
[ | ||
[ | ||
"Groonga is great!" | ||
] | ||
] | ||
], | ||
[ | ||
"ruby", | ||
1, | ||
[ | ||
[ | ||
"Hi! I'm a new Rubyist!" | ||
] | ||
] | ||
] | ||
] | ||
} | ||
} | ||
} | ||
] |
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,80 @@ | ||
# -*- js -*- | ||
#@disable-logging | ||
{ | ||
"type": "add", | ||
"dataset": "Droonga", | ||
"body": { | ||
"table": "Threads", | ||
"key": "ruby", | ||
"values": { | ||
"name": "Ruby" | ||
} | ||
} | ||
} | ||
{ | ||
"type": "add", | ||
"dataset": "Droonga", | ||
"body": { | ||
"table": "Threads", | ||
"key": "groonga", | ||
"values": { | ||
"name": "Groonga" | ||
} | ||
} | ||
} | ||
{ | ||
"type": "add", | ||
"dataset": "Droonga", | ||
"body": { | ||
"table": "Comments", | ||
"key": "1", | ||
"values": { | ||
"thread": "ruby", | ||
"content": "Hi! I'm a new Rubyist!" | ||
} | ||
} | ||
} | ||
{ | ||
"type": "add", | ||
"dataset": "Droonga", | ||
"body": { | ||
"table": "Comments", | ||
"key": "2", | ||
"values": { | ||
"thread": "groonga", | ||
"content": "Groonga is great!" | ||
} | ||
} | ||
} | ||
#@enable-logging | ||
{ | ||
"type": "search", | ||
"dataset": "Droonga", | ||
"body": { | ||
"queries": { | ||
"comments": { | ||
"source": "Comments", | ||
"groupBy": { | ||
"key": "thread", | ||
"maxNSubRecords": 10 | ||
}, | ||
"sortBy": ["_key"], | ||
"output": { | ||
"elements": ["count", "records"], | ||
"limit": -1, | ||
"attributes": [ | ||
"_key", | ||
"_nsubrecs", | ||
{ | ||
"label": "items", | ||
"source": "_subrecs", | ||
"attributes": [ | ||
"content" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |