更新时间:2021-11-04 08:25:07
我不确定这个,但我猜你需要用 转义
-
.根据 Lucene 文档.
I am not sure about this , but I guess you need to escape -
with . As per the Lucene docs.
-"或禁止运算符排除包含-"之后的术语的文档.符号.
The "-" or prohibit operator excludes documents that contain the term after the "-" symbol.
再次,
Lucene 支持对属于查询语法一部分的特殊字符进行转义.当前列表特殊字符为
Lucene supports escaping special characters that are part of the query syntax. The current list special characters are
+ - &&||!( ) { } [ ] ^ "~ * ?: /
+ - && || ! ( ) { } [ ] ^ " ~ * ? : /
要转义这些字符,请在字符前使用 .
To escape these character use the before the character.
另外请记住,如果某些字符在 Java 中具有特殊含义,则需要转义两次.
Also remember, some characters you'll need to escape twice if they have special meaning in Java.