po_*_*aka 5 lucene elasticsearch
我有pattern_replace令牌过滤器(es docs)
'addressPattern' => array(
'type' => 'pattern_replace',
'pattern' => '(str\.|street|and many more like this)',
'replacement' => '',
),
Run Code Online (Sandbox Code Playgroud)
如何使匹配不区分大小写?
很抱歉,这个答案不及时,但我正在寻找在Elasticsearch中执行不区分大小写的模式匹配的问题.一种方法是你可以使用嵌入式标志:
'pattern' => '(?i)(str\.|street|and many more like this)',
嵌入式标志使用(?xyz)语法,其中xyz是标志.其他标志是'u'用于unicode情况,'m'用于多行,'s'用于dotall,以及更多.通常我和s是最有用的标志,如果使用非英语单词,你也可以使用它.请注意,嵌入标志是上下文的 - 如果将其放在组的开头,则仅适用于该组.
Lucene使用Java的标准库正则表达式,因此有关更多详细信息,请参阅util.regex.Pattern的java文档或java正则表达式模式的教程.
| 归档时间: |
|
| 查看次数: |
1037 次 |
| 最近记录: |