My app allows users to search for classifieds listings (motorcycles). One of the possible queries they can currently perform is “show me touring bikes offered by dealers”. Both “dealer” and “touring” are two-plies out from the listings:
Listing → Feed → Dealer (optional)
Listing > VehicleModel → VehicleStyle
I attach the query that I have so far - the first one just lists the data so you can see what is in there, the second query tries to match it. I have trouble figuring out though how I can add the second constraint (VehicleModel → VehicleStyle) to the second query, and still get all the optional properties of the listing (such as price_usd which is actually empty). I attach my current queries/results, and a graphical representation of the problem.
Thanks for any help!
query pastebin: { node(func: uid(0x2802)) { feed { uid name dealer { - Pastebin.com
result pastebin: { "data": { "node": [ { "feed": [ { - Pastebin.com
QUERIES
{
node(func: uid(0x2802)) {
feed {
uid
name
dealer {
uid
name
}
}
vehicle.model {
uid
name
vehicle.style {
uid
name
}
}
type
uid
name
price_usd
}
#want: listings that are touring hondas by dealers
#this only gets listings that are
#hondas by dealers, but doesn't have
#a vehicle.style constraint
dealerfeed(func: has(dealer)) @filter(eq(type, "Feed")) {
~feed @filter(eq(type, "Listing")){
uid
name
price_usd
}
}
}
RESULTS
{
"data": {
"node": [
{
"feed": [
{
"uid": "0x2b50",
"name": "Best Powersports New Bikes",
"dealer": [
{
"uid": "0x2b51",
"name": "Best Powersports"
}
]
}
],
"vehicle.model": [
{
"uid": "0x2b53",
"name": "Honda ST",
"vehicle.style": [
{
"uid": "0x2b4d",
"name": "Touring"
}
]
}
],
"type": "Listing",
"uid": "0x2802",
"name": "Honda ST 1100 Motorcycle"
}
],
"dealerfeed": [
{
"~feed": [
{
"uid": "0x2802",
"name": "Honda ST 1100 Motorcycle"
}
],
"uid": "0x2b50"
}
]
},
"extensions": {
"server_latency": {
"parsing_ns": 84900,
"processing_ns": 11426300,
"encoding_ns": 2410100
},
"txn": {
"start_ts": 119547
}
}
}