Hi, I’m wondering why are data filtered out when sorting is used?
Here is example:
Schema:
city: string .
name: string .
state: string @index(exact) .
type: string @index(exact) .
mutation:
{
set {
_:book1 <name> "Book 1" .
_:book1 <city> "NY" .
_:book1 <state> "USA" .
_:book1 <type> "paper" .
_:book2 <name> "Book 2" .
_:book2 <city> "Bratislava" .
_:book2 <state> "Slovakia" .
_:book2 <type> "paper" .
_:book3 <name> "Book 3" .
_:book3 <city> "Chicago" .
_:book3 <type> "paper" .
}
}
First query returns all tree books:
{
paperBooks(func: eq(type,"paper")) {
expand(_all_)
}
}
result:
{
"data": {
"paperBooks": [
{
"type": "paper",
"state": "USA",
"name": "Book 1",
"city": "NY"
},
{
"type": "paper",
"state": "Slovakia",
"name": "Book 2",
"city": "Bratislava"
},
{
"type": "paper",
"name": "Book 3",
"city": "Chicago"
}
]
},
"extensions": {
"server_latency": {
"parsing_ns": 10437,
"processing_ns": 4036215,
"encoding_ns": 1085967
},
"txn": {
"start_ts": 44
}
}
}
Same query with sorting:
{
paperBooks(func: eq(type,"paper"),orderasc: state) {
expand(_all_)
}
}
Result (book 3 is missing):
{
"data": {
"paperBooks": [
{
"state": "Slovakia",
"name": "Book 2",
"city": "Bratislava",
"type": "paper",
"uid": "0xb"
},
{
"state": "USA",
"name": "Book 1",
"city": "NY",
"type": "paper",
"uid": "0xa"
}
]
},
"extensions": {
"server_latency": {
"parsing_ns": 7123,
"processing_ns": 6755452,
"encoding_ns": 476294
},
"txn": {
"start_ts": 45
}
}
}
Why? Why are not nodes without sorting predicate added to start or end of result set?