org.apache.lucene.search.regex
Class JavaUtilRegexCapabilities

java.lang.Object
  extended by org.apache.lucene.search.regex.JavaUtilRegexCapabilities

public class JavaUtilRegexCapabilities
extends Object

An implementation tying Java's built-in java.util.regex to RegexQuery. Note that because this implementation currently only returns null from prefix() that queries using this implementation will enumerate and attempt to match(java.lang.String) each term for the specified field in the index.


Constructor Summary
JavaUtilRegexCapabilities()
           
 
Method Summary
 void compile(String pattern)
          Called by the constructor of RegexTermEnum allowing implementations to cache a compiled version of the regular expression pattern.
 boolean equals(Object o)
           
 int hashCode()
           
 boolean match(String string)
           
 String prefix()
          A wise prefix implementation can reduce the term enumeration (and thus performance) of RegexQuery dramatically!
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaUtilRegexCapabilities

public JavaUtilRegexCapabilities()
Method Detail

compile

public void compile(String pattern)
Called by the constructor of RegexTermEnum allowing implementations to cache a compiled version of the regular expression pattern.

Parameters:
pattern - regular expression pattern

match

public boolean match(String string)
Returns:
true if string matches the pattern last passed to compile(java.lang.String).

prefix

public String prefix()
A wise prefix implementation can reduce the term enumeration (and thus performance) of RegexQuery dramatically!

Returns:
static non-regex prefix of the pattern last passed to compile(java.lang.String). May return null.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2000-2010 Apache Software Foundation. All Rights Reserved.