We are using a GraphQL Schema and for some special cases we need reverse index to execute some custom queries but I couldn’t find a way to put this inside the GraphQL Schema and after each GraphQL Schema upload I must add this reverse index to schema manually. Is there a way to tell dgraph that a field has reverse index(I’m not talking about hasInverse):
In this example I want to have a reverse index on Movie.tags predicate.
type Movie {
id: ID!
name: String!
tags: [Tag] # need something here
}
type Tag {
TagID: ID!
nameL: String!
}
This seems like a simple enough feature request. The OP is not asking for the reverse functionality in the GraphQL query API, just a directive that when applied in the GraphQL schema adds the reverse directive in the underlying DQL schema.
@pshaddel we also experienced this issue (and related problems such as count indexes also disappearing). A (bad) workaround is to also update your dql schema after each gql update. We generate our schemas from a yaml config file so the two are always in sync. But yes it would be nicer for this to be fixed in the product instead in future.
@RJKeevil
Thank you for your response.
I just took a look at this: https://dgraph.io/docs/deploy/config/#yaml-config-file but couldn’t find anything about schema.
Could you please specify in more details what steps should I take to accomplish something like your setup?
I’m afraid that it is custom Go code in my company’s application. We have some types (Go structs) that we use to generate matching graphQL and DQL schemas as part of a setup script. Its not something I can share unfortunately.