-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix/dgraph): Fix facets response with normalize (#5690)
Fixes: #5241 Fixes: DGRAPH-1670 This PR fixes issue with facets when it is retrieved in a query containing @normalize directive. While forming @normalize response, we flatten a fastJsonNode and make its grand children, direct children of it. This should be valid in all of cases except when fastJsonNode is parent of facets nodes. For example consider below data: <0x1> <name> "Alice" . <0x1> <friend> "Bob" (from="college") . <0x1> <friend> "Roman" (from="school") . Also consider below query: q(func: uid(0x1)) @normalize { name: name friend: friends @facets } Expected response is: { "data": { "q": [ { "name": "Alice", "friends|from": { "0": "college", "1": "school" }, "friends": [ "Bob", "Roman" ] } ] } } But actual response is: { "data": { "q": [ { "0": "college", "1": "school", "friends": [ "Bob", "Roman" ], "name": "Alice" } ] } } Its happening because we are flattening facet parent node friends|from as well which have node "0" and "1" as children. We are solving it by having extra information in the node if it is a facets parent.
- Loading branch information
1 parent
f2773c8
commit f4c28b8
Showing
2 changed files
with
222 additions
and
17 deletions.
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
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