Dgraph supports string text and queries as UTF-8.
String valued predicates can be annotated with a language tag.
Amit’s name was stored in English "Amit"@en
, Hindi "अमित"@hi
and Bengali
"অমিত"@bn
. Michael’s was stored in English. Artyom’s was stored in English and
Russian "Артём"@ru
. Sang Hyun’s was stored in English and Korean "상현"@ko
.
Queries can search over text in the tagged languages by specifying which
language to search and which languages to return. The syntax @lang1:...:langN
specifies the preference order for returned languages with the following rules:
.
, in which case the value without a
specified language is returned, or if there is no value without language, a
value in “some” language is returned.Try changing name@ko:ru
to name@ko:ru:.
to find the missing friend’s name.
{
language_support(func: allofterms(name@hi, "अमित")) {
name@bn:hi:en
age
friend {
name@ko:ru
age
}
}
}
2.4 Language Support