Class EscapeQuerySyntaxImpl
java.lang.Object
org.apache.lucene.queryparser.flexible.standard.parser.EscapeQuerySyntaxImpl
- All Implemented Interfaces:
EscapeQuerySyntax
Implementation of
EscapeQuerySyntax for the standard lucene syntax.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.lucene.queryparser.flexible.core.parser.EscapeQuerySyntax
EscapeQuerySyntax.Type -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic UnescapedCharSequencediscardEscapeChar(CharSequence input) Returns a String where the escape char has been removed, or kept only once if there was a double escape.escape(CharSequence text, Locale locale, EscapeQuerySyntax.Type type) private static final CharSequenceescapeChar(CharSequence str, Locale locale) private final CharSequenceescapeQuoted(CharSequence str, Locale locale) private static final CharSequenceescapeTerm(CharSequence term, Locale locale) private static final CharSequenceescapeWhiteChar(CharSequence str, Locale locale) escape all tokens that are part of the parser syntax on a given stringprivate static final inthexToInt(char c) Returns the numeric value of the hexadecimal characterprivate static CharSequencereplaceIgnoreCase(CharSequence string, CharSequence sequence1, CharSequence escapeChar, Locale locale) replace with ignore case
-
Field Details
-
wildcardChars
private static final char[] wildcardChars -
escapableTermExtraFirstChars
-
escapableTermChars
-
escapableQuotedChars
-
escapableWhiteChars
-
escapableWordTokens
-
-
Constructor Details
-
EscapeQuerySyntaxImpl
public EscapeQuerySyntaxImpl()
-
-
Method Details
-
escapeChar
-
escapeQuoted
-
escapeTerm
-
replaceIgnoreCase
private static CharSequence replaceIgnoreCase(CharSequence string, CharSequence sequence1, CharSequence escapeChar, Locale locale) replace with ignore case- Parameters:
string- string to get replacedsequence1- the old character sequence in lowercaseescapeChar- the new character to prefix sequence1 in return string.- Returns:
- the new String
-
escapeWhiteChar
escape all tokens that are part of the parser syntax on a given string- Parameters:
str- string to get replacedlocale- locale to be used when performing string compares- Returns:
- the new String
-
escape
- Specified by:
escapein interfaceEscapeQuerySyntax- Parameters:
text- - text to be escapedlocale- - locale for the current querytype- - select the type of escape operation to use- Returns:
- escaped text
-
discardEscapeChar
Returns a String where the escape char has been removed, or kept only once if there was a double escape.Supports escaped unicode characters, e. g. translates
AtoA.- Throws:
ParseException
-
hexToInt
Returns the numeric value of the hexadecimal character- Throws:
ParseException
-