Package org.apache.lucene.search.regex
Class JakartaRegexpCapabilities
- java.lang.Object
-
- org.apache.lucene.search.regex.JakartaRegexpCapabilities
-
- All Implemented Interfaces:
RegexCapabilities
public class JakartaRegexpCapabilities extends Object implements RegexCapabilities
Implementation tying Jakarta Regexp to RegexQuery. Jakarta Regepx internally supports aprefix()implementation which can offer performance gains under certain circumstances. Yet, the implementation appears to be rather shaky as it doesn't always provide a prefix even if one would exist.
-
-
Field Summary
Fields Modifier and Type Field Description static intFLAG_MATCH_CASEINDEPENDENTFlag to specify that matching should be case-independent (folded)static intFLAG_MATCH_NORMALFlag to specify normal, case-sensitive matching behaviour.
-
Constructor Summary
Constructors Constructor Description JakartaRegexpCapabilities()Constructs a RegexCapabilities with the default MATCH_NORMAL match style.JakartaRegexpCapabilities(int flags)Constructs a RegexCapabilities with the provided match flags.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcompile(String pattern)Called by the constructor ofRegexTermEnumallowing implementations to cache a compiled version of the regular expression pattern.booleanequals(Object o)inthashCode()booleanmatch(String string)Stringprefix()A wise prefix implementation can reduce the term enumeration (and thus increase performance) of RegexQuery dramatically!
-
-
-
Field Detail
-
FLAG_MATCH_NORMAL
public static final int FLAG_MATCH_NORMAL
Flag to specify normal, case-sensitive matching behaviour. This is the default.- See Also:
- Constant Field Values
-
FLAG_MATCH_CASEINDEPENDENT
public static final int FLAG_MATCH_CASEINDEPENDENT
Flag to specify that matching should be case-independent (folded)- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JakartaRegexpCapabilities
public JakartaRegexpCapabilities()
Constructs a RegexCapabilities with the default MATCH_NORMAL match style.
-
JakartaRegexpCapabilities
public JakartaRegexpCapabilities(int flags)
Constructs a RegexCapabilities with the provided match flags. Multiple flags should be ORed together.- Parameters:
flags- The matching style
-
-
Method Detail
-
compile
public void compile(String pattern)
Description copied from interface:RegexCapabilitiesCalled by the constructor ofRegexTermEnumallowing implementations to cache a compiled version of the regular expression pattern.- Specified by:
compilein interfaceRegexCapabilities- Parameters:
pattern- regular expression pattern
-
match
public boolean match(String string)
- Specified by:
matchin interfaceRegexCapabilities- Returns:
- true if string matches the pattern last passed to
RegexCapabilities.compile(java.lang.String).
-
prefix
public String prefix()
Description copied from interface:RegexCapabilitiesA wise prefix implementation can reduce the term enumeration (and thus increase performance) of RegexQuery dramatically!- Specified by:
prefixin interfaceRegexCapabilities- Returns:
- static non-regex prefix of the pattern last passed to
RegexCapabilities.compile(java.lang.String). May return null.
-
-