Class LuceneUtils
- java.lang.Object
-
- org.owasp.dependencycheck.data.lucene.LuceneUtils
-
@ThreadSafe public final class LuceneUtils extends java.lang.Object
Lucene utils is a set of utilize written to make constructing Lucene queries simpler.
- Author:
- Jeremy Long
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
appendEscapedLuceneQuery(java.lang.StringBuilder buf, java.lang.CharSequence text)
Appends the text to the supplied StringBuilder escaping Lucene control characters in the process.static java.lang.String
escapeLuceneQuery(java.lang.CharSequence text)
Escapes the text passed in so that it is treated as data instead of control characters.static boolean
isKeyword(java.lang.String term)
Determines if the given term is a Lucene keyword (e.g.
-
-
-
Method Detail
-
isKeyword
public static boolean isKeyword(java.lang.String term)
Determines if the given term is a Lucene keyword (e.g. AND, OR, NOT).- Parameters:
term
- the term to test- Returns:
true
if the term is a keyword; otherwisefalse
-
appendEscapedLuceneQuery
public static void appendEscapedLuceneQuery(java.lang.StringBuilder buf, java.lang.CharSequence text)
Appends the text to the supplied StringBuilder escaping Lucene control characters in the process.- Parameters:
buf
- a StringBuilder to append the escaped text totext
- the data to be escaped
-
escapeLuceneQuery
public static java.lang.String escapeLuceneQuery(java.lang.CharSequence text)
Escapes the text passed in so that it is treated as data instead of control characters.- Parameters:
text
- data to be escaped- Returns:
- the escaped text.
-
-