Hi,I found language support for term tokenization in Dgraph v20.11.0 Release, and then I started dgraph using docker , And started my test, and found that the query related to term in v20.11.0 is more unfriendly to Chinese-no results.
The docker-compose file is as follows:
version: "2.3"
services:
zero:
image: dgraph/dgraph:v20.11.0
volumes:
- ./dgraph_data:/dgraph
ports:
- 5280:5080
- 6280:6080
restart: on-failure
command: dgraph zero --my=zero:5080
server:
image: dgraph/dgraph:v20.11.0
volumes:
- ./dgraph_data:/dgraph
ports:
- 8280:8080
- 9280:9080
restart: on-failure
command: dgraph alpha --whitelist 0.0.0.0:255.255.255.255 --my=server:7080 --lru_mb=20480 --zero=zero:5080 --postings out/0/p
ratel:
image: dgraph/dgraph:v20.11.0
volumes:
- ./dgraph_data:/dgraph
ports:
- 8200:8000
command: dgraph-ratel
After startup, import test data
curl -H "Content-Type: application/rdf" "192.168.31.131:8280/mutate?commitNow=true" -XPOST -d $'
{
set {
_:diyijie <title@zh> "第一届三中全会议纪要" .
_:diyijie <dgraph.type> "Paper" .
_:dierjie <title@zh> "第二届三中全会议纪要" .
_:dierjie <dgraph.type> "Paper" .
_:disanjie <title@zh> "第三届三中全会议纪要" .
_:disanjie <dgraph.type> "Paper" .
_:diyierjie <title@zh> "第一届第二届三中全会议纪要" .
_:diyierjie <dgraph.type> "Paper" .
_:yimadangxian <title@zh> "一马当先的由来" .
_:yimadangxian <dgraph.type> "Paper" .
_:huanjie <title@zh> "换届的影响" .
_:huanjie <dgraph.type> "Paper" .
}
}
' | python -m json.tool | less
create a new schema
curl "192.168.31.131:8280/alter" -XPOST -d $'
title: string @index(hash,term,trigram,fulltext) @lang .
type Paper {
title
}
' | python -m json.tool | less
DQL
{
me(func:anyofterms(title@zh, "第一届")) {
title@zh
uid
dgraph.type
}
}
query result
# v20.11.0
{
"data": {
"me": []
}
}
# v20.07.0
{
"data": {
"me": [
{
"title@zh": "一马当先的由来",
"uid": "0x2711",
"dgraph.type": [
"Paper"
]
},
{
"title@zh": "换届的影响",
"uid": "0x2712",
"dgraph.type": [
"Paper"
]
},
{
"title@zh": "第一届三中全会议纪要",
"uid": "0x2713",
"dgraph.type": [
"Paper"
]
},
{
"title@zh": "第二届三中全会议纪要",
"uid": "0x2714",
"dgraph.type": [
"Paper"
]
},
{
"title@zh": "第三届三中全会议纪要",
"uid": "0x2715",
"dgraph.type": [
"Paper"
]
},
{
"title@zh": "第一届第二届三中全会议纪要",
"uid": "0x2716",
"dgraph.type": [
"Paper"
]
}
]
}
}
It can be seen that v20.11.0 does not have any query results. Although the final result of v20.07.0 has a different design concept, there are at least relevant results.
In fact, I want to use term to achieve the function of fuzzy search in Chinese, but now v20.11.0 can’t search for any results.
I want to ask, did I do something wrong?