是否可以将 path_hierarchy 标记器与其中包含空格的路径一起使用,并让它仅基于分隔符而不是空格来创建标记?例如,
“/机场/机库 1”
将被标记为
“机场”,“机库 1”,
不是
“机场”、“机库”、“1”?
是否可以将 path_hierarchy 标记器与其中包含空格的路径一起使用,并让它仅基于分隔符而不是空格来创建标记?例如,
“/机场/机库 1”
将被标记为
“机场”,“机库 1”,
不是
“机场”、“机库”、“1”?
path_hierarchy 分词器在带有空格的路径上工作得很好:
curl "localhost:9200/_analyze?tokenizer=path_hierarchy&pretty=true" -d "/airport/hangar 1"
{
"tokens" : [ {
"token" : "/airport",
"start_offset" : 0,
"end_offset" : 8,
"type" : "word",
"position" : 1
}, {
"token" : "/airport/hangar 1",
"start_offset" : 0,
"end_offset" : 17,
"type" : "word",
"position" : 1
} ]
}
但是,根据您的示例,您可能需要改用模式标记器。