I have a schema that at a high level looks like this
<Restaurant.name>: string @index(fulltext, trigram) .
<Restaurant.address>: uid @reverse .
<Boutique.name>: string @index(fulltext, trigram) .
<Boutique.address>: uid @reverse .
<Address.address1>: string @index(fulltext, trigram) .
<Address.city>: uid @reverse .
<City.name>: string @index(fulltext, trigram) .
<City.state>: uid @reverse .
<State.name>: string @index(fulltext, trigram) .
And I want to do a reverse lookup with pagination of all restaurants within a given city, so I worked out something like this to begin with.
query {
Restaurants (func: anyoftext(State.name, "new york")) @cascade {
State.name
~City.state {
City.name
~Address.city (first:10, offset:10) {
Address.address1
~Restaurant.address {
Restaurant.name
}
}
}
}
}
So I’m trying to get all Addresses in the state of New York (or any state(s) really), and limiting the type of store to only Restaurants. But when I run this query, it retrieves less than 10 Restaurants when I know there’s more than that.
What I’ve found was since the address can have different parent types, all the Addresses that belong to Boutiques were “hidden” but still included in the pagination search, meaning when I ask for 10 results I will always potentially get less, which isn’t very deterministic.
So I feel like I’m probably doing something wrong here, is there a better way to write this query to get what I’m looking for? Or are things done wrong starting from the schema itself?
EDIT: My db version is v20.11.2-rc1-25-g4400610b2, and I’m using Cascade to limit the type to Restaurants