gpt4 book ai didi

regex - Elasticsearch跳过@ -symbol

转载 作者:行者123 更新时间:2023-12-03 00:06:02 26 4
gpt4 key购买 nike

我有一个提供了char过滤器的自定义分析器:

"char_filter": {
"hash_repl": {
"pattern": "(^[^\\#@].+)",
"type": "pattern_replace",
"preserve_original": "false",
"replacement": "$1 #$1 @$1"
}
}

当我发送测试分析仪的POST请求时,我正在等待以下行为:
a => a #a @a
#a => #a
@a => @a

问题是 flex 不会在响应中显示“@”符号,通常我会得到
a => a #a a
#a => #a
@a => a

最佳答案

好吧,解决方案很容易。我的自定义分析器还包含几个字符过滤器和 token 过滤器。通过添加自定义映射解决了该问题:

"char_filter": {
"custom": {
"type": "mapping",
"mappings": [
"#=>|#"
]
}
},
"filter": {
"custom": {
"type": "word_delimiter",
"type_table": [
"# => ALPHA",
"@ => ALPHA"
],
"split_on_numerics": "false"
}
}

关于regex - Elasticsearch跳过@ -symbol,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44880875/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com