Escaping special characters

Lucene supports escaping special characters that are part of the query syntax.

The following special characters are defined:

+ - && || ! ( ) { } [ ] ^ " ~ * ? : \

To escape a special character, precede the character with a backslash (\).

Examples:
  • To search for the string (1+1):2, use the following syntax:
    \(1+1\)\:2
  • To search for a Uniform Naming Convention (UNC) path specification, such as \\server_name\shared_resource_path, use the following syntax:
    \\\\server_name\\shared_resource_path

Feedback