Class EscapeQuerySyntaxImpl
- java.lang.Object
-
- org.apache.lucene.queryparser.flexible.standard.parser.EscapeQuerySyntaxImpl
-
- All Implemented Interfaces:
EscapeQuerySyntax
public class EscapeQuerySyntaxImpl extends java.lang.Object implements EscapeQuerySyntax
Implementation ofEscapeQuerySyntaxfor 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 Modifier and Type Field Description private static java.lang.String[]escapableQuotedCharsprivate static java.lang.String[]escapableTermCharsprivate static java.lang.String[]escapableTermExtraFirstCharsprivate static java.lang.String[]escapableWhiteCharsprivate static java.lang.String[]escapableWordTokensprivate static char[]wildcardChars
-
Constructor Summary
Constructors Constructor Description EscapeQuerySyntaxImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static UnescapedCharSequencediscardEscapeChar(java.lang.CharSequence input)Returns a String where the escape char has been removed, or kept only once if there was a double escape.java.lang.CharSequenceescape(java.lang.CharSequence text, java.util.Locale locale, EscapeQuerySyntax.Type type)private static java.lang.CharSequenceescapeChar(java.lang.CharSequence str, java.util.Locale locale)private java.lang.CharSequenceescapeQuoted(java.lang.CharSequence str, java.util.Locale locale)private static java.lang.CharSequenceescapeTerm(java.lang.CharSequence term, java.util.Locale locale)private static java.lang.CharSequenceescapeWhiteChar(java.lang.CharSequence str, java.util.Locale locale)escape all tokens that are part of the parser syntax on a given stringprivate static inthexToInt(char c)Returns the numeric value of the hexadecimal characterprivate static java.lang.CharSequencereplaceIgnoreCase(java.lang.CharSequence string, java.lang.CharSequence sequence1, java.lang.CharSequence escapeChar, java.util.Locale locale)replace with ignore case
-
-
-
Field Detail
-
wildcardChars
private static final char[] wildcardChars
-
escapableTermExtraFirstChars
private static final java.lang.String[] escapableTermExtraFirstChars
-
escapableTermChars
private static final java.lang.String[] escapableTermChars
-
escapableQuotedChars
private static final java.lang.String[] escapableQuotedChars
-
escapableWhiteChars
private static final java.lang.String[] escapableWhiteChars
-
escapableWordTokens
private static final java.lang.String[] escapableWordTokens
-
-
Method Detail
-
escapeChar
private static final java.lang.CharSequence escapeChar(java.lang.CharSequence str, java.util.Locale locale)
-
escapeQuoted
private final java.lang.CharSequence escapeQuoted(java.lang.CharSequence str, java.util.Locale locale)
-
escapeTerm
private static final java.lang.CharSequence escapeTerm(java.lang.CharSequence term, java.util.Locale locale)
-
replaceIgnoreCase
private static java.lang.CharSequence replaceIgnoreCase(java.lang.CharSequence string, java.lang.CharSequence sequence1, java.lang.CharSequence escapeChar, java.util.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
private static final java.lang.CharSequence escapeWhiteChar(java.lang.CharSequence str, java.util.Locale locale)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
public java.lang.CharSequence escape(java.lang.CharSequence text, java.util.Locale locale, EscapeQuerySyntax.Type type)- 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
public static UnescapedCharSequence discardEscapeChar(java.lang.CharSequence input) throws ParseException
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. translatesAtoA.- Throws:
ParseException
-
hexToInt
private static final int hexToInt(char c) throws ParseExceptionReturns the numeric value of the hexadecimal character- Throws:
ParseException
-
-