Dgraph: v20.11.2
The allofterms fuzzy search produces incorrect results .
Scenario as follows:
Schema:
apple_movietrailer_id: string .
fandango_id: string .
initial_release_date: datetime @index(year) .
metacritic_id: string .
name: string @index(hash, term, trigram, fulltext) @lang .
netflix_id: string .
prequel: [uid] .
rottentomatoes_id: string .
actor.dubbing_performances: [uid] .
rating: [uid] @reverse .
country: [uid] @reverse .
rated: [uid] @reverse .
type Film {
apple_movietrailer_id: string
fandango_id: string
initial_release_date: dateTime
metacritic_id: string
name: string
netflix_id: string
prequel: [Film]
rottentomatoes_id: string
}
type Actor {
name: string
actor.dubbing_performances: [Film]
}
When I load the following data query
{
set{
_:a <name> "Jackie Chan"@en .
_:b <name> "Jet Li"@en .
_:c <name> "Bruce Lee"@en .
_:a <name> "成龙"@cn .
_:b <name> "李连杰"@cn .
_:c <name> "李小龙"@cn .
_:a <dgraph.type> "Actor" .
_:b <dgraph.type> "Actor" .
_:c <dgraph.type> "Actor" .
}
}
The results were correct:
// query
{
var(func: allofterms( <name>@., "成龙" ))@filter( (allofterms(<name>@., "成龙")) and type( <Actor>)){
uid0 as uid
}
statistics(func: uid(uid0)){count(uid)}
q(func: uid(uid0), first:40,offset:0){
dgraphType:dgraph.type
expand(_all_)
}
}
// results
{"statistics":[{"count":1}],"q":[{"dgraphType":["Actor"],"name@en":"Jackie Chan","name@cn":"成龙"}]}
But
When I load the following data query:
{
set{
_:a <name> "Jackie Chan"@en .
_:b <name> "Jet Li"@en .
_:c <name> "Bruce Lee"@en .
_:a <name> "成龙"@zh .
_:b <name> "李连杰"@zh .
_:c <name> "李小龙"@zh .
_:a <dgraph.type> "Actor" .
_:b <dgraph.type> "Actor" .
_:c <dgraph.type> "Actor" .
}
}
The results were correct:
// query
{
var(func: allofterms( <name>@., "成龙" ))@filter( (allofterms(<name>@., "成龙")) and type( <Actor>)){
uid0 as uid
}
statistics(func: uid(uid0)){count(uid)}
q(func: uid(uid0), first:40,offset:0){
dgraphType:dgraph.type
expand(_all_)
}
}
// results
{"statistics":[{"count":0}],"q":[]}
Is that a bug? I just replaced cn with zh?