Lucene supports escaping special characters that are part of the query syntax. Special characters in the current list
+ - && || ! ( ) { } [ ] ^ " ~ * ? : \
To avoid these characters, use the \ character before the character. For example, to search for (1 + 1): 2, use the query:
\(1\+1\)\:2
My question is how to avoid a whole line at a time? For example myStringToEscape = "ABC^ " ~ * ? :DEF"; myStringToEscape = "ABC^ " ~ * ? :DEF"; How to get escapedString .
source share