org.apache.lucene.search.regex

Class JavaUtilRegexCapabilities

Implemented Interfaces:
org.apache.lucene.search.regex.RegexCapabilities

public class JavaUtilRegexCapabilities
extends Object
implements org.apache.lucene.search.regex.RegexCapabilities

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(String) each term for the specified field in the index.

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!

Method Details

compile

public void compile(String pattern)
Called by the constructor of RegexTermEnum allowing implementations to cache a compiled version of the regular expression pattern.
Specified by:
compile in interface org.apache.lucene.search.regex.RegexCapabilities
Parameters:
pattern - regular expression pattern

equals

public boolean equals(Object o)

hashCode

public int hashCode()

match

public boolean match(String string)
Specified by:
match in interface org.apache.lucene.search.regex.RegexCapabilities
Parameters:
string -
Returns:
true if string matches the pattern last passed to compile.

prefix

public String prefix()
A wise prefix implementation can reduce the term enumeration (and thus performance) of RegexQuery dramatically!
Specified by:
prefix in interface org.apache.lucene.search.regex.RegexCapabilities
Returns:
static non-regex prefix of the pattern last passed to compile. May return null.

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