Dgraph: Small bug in Getting Started example - Need help to send PR :)

Created on 27 Aug 2018  Â·  10Comments  Â·  Source: dgraph-io/dgraph

First of all, awesome database. I have tried it out in the past and it was damn cool. Now it looks cooler ;) I have recently come back to use the DB in an application and see how it works. While trying out the getting started page, I encountered an error, thought I will help out by fixing it.


While I was trying out this section : https://docs.dgraph.io/get-started#get-all-movies

I got this error:

{
    "data": null,
    "errors": [
        {
            "code": "ErrorInvalidRequest",
            "message": ": Language tags can only be used with predicates of string type having @lang directive in schema. Got: [name]"
        }
    ]
}

From the looks of it, I think we should add some @lang directive in the schema, or not used @en language tag in the query. Doing either one of these should solve the problem. So, what do I do ? Change schema in this section https://docs.dgraph.io/get-started#adding-indexes or get rid of the @en language tag in the query ? Let me know so that I can help 😄

aredocumentation

All 10 comments

you can simply use:

{
 me(func: has(starring)) {
   name
  }
}

Or change the indexing in this way:

  name: string @index(term) @lang .
  release_date: datetime @index(year) .
  revenue: float .
  running_time: int .

And use like this:

{
 me(func: has(starring)) {
   name@en: .
  }
}

But read carefully about language support: https://docs.dgraph.io/query-language/#language-support

Cheers

@MichelDiz I understand that, but the docs are having a wrong curl command. I raised the issue to fix the docs. This wasn't exactly a question. I was asking a question about how I should solve the issue with any one of the possible ways that you just mentioned

Can you please read the issue again and reopen this issue and let me know which way I should fix the docs? @MichelDiz

oh well! you wanna help. Nice! Sorry about that, I thought you was asking how to solve this.
I was already preparing to edit, but feel free xD your help is of great value.

Just make a Dgraph fork, edit the link below and send us the PR.

https://github.com/dgraph-io/dgraph/tree/master/wiki/content/get-started

We appreciate it

Cheers.

PS. Btw use the @langdirective and the lang tag as well.

There's also an "Edit Page" button on the doc page itself you could use.

Looking forward to your PR, @karuppiah7890!

Sure, will send a PR :)
So for the fix, shall I just change the query to not give a language tag?

On Tue, Aug 28, 2018, 1:08 AM Daniel Mai notifications@github.com wrote:

There's also an "Edit Page" button on the doc page itself you could use.

Looking forward to your PR, @karuppiah7890
https://github.com/karuppiah7890!

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dgraph-io/dgraph/issues/2552#issuecomment-416342962,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMNw6CCpVD29t0z2G0gqVMzBOpPMzgp6ks5uVEqrgaJpZM4WNHUm
.

@karuppiah7890 Yes, modify the query without the language tag. The original data set doesn't have language-specific names anyway.

Cool, will do and send the PR your way :) looking forward to send more PRs
and help the docs and probably even code in the future :)

On Tue, Aug 28, 2018, 7:53 AM Daniel Mai notifications@github.com wrote:

@karuppiah7890 https://github.com/karuppiah7890 Yes, modify the query
without the language tag. The original data set doesn't have
language-specific names anyway.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dgraph-io/dgraph/issues/2552#issuecomment-416429433,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMNw6LzZalNCRQA3atGvzaDRctCnvIIhks5uVKmigaJpZM4WNHUm
.

I sent a PR. cc @danielmai @MichelDiz 😄

Great! I'll take a look.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

djdoeslinux picture djdoeslinux  Â·  4Comments

captain-me0w picture captain-me0w  Â·  4Comments

MichelDiz picture MichelDiz  Â·  3Comments

ShawnMilo picture ShawnMilo  Â·  4Comments

protheusfr picture protheusfr  Â·  4Comments