Fixed issue 34: Behavior of Text Filter is unpredictable when "regular expression" mode is enabled.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@766 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-05-14 16:51:31 +00:00
parent 0af4e294f8
commit bd87e079b2
2 changed files with 16 additions and 12 deletions

View File

@ -1,3 +1,10 @@
Ongoing
Fixes:
- Issue 34: "Behavior of Text Filter is unpredictable when "regular expression" mode is enabled."
Regex was not compiled with case insensitivity flag.
1.0.1 Release (May 12, 2010)
Fixes:

View File

@ -58,19 +58,16 @@ public class TextSearchFacet implements Facet {
_mode = o.getString("mode");
_caseSensitive = o.getBoolean("caseSensitive");
if (_query != null) {
_query = _query.trim();
if (_query.length() > 0) {
if (!_caseSensitive) {
_query = _query.toLowerCase();
}
if ("regex".equals(_mode)) {
try {
_pattern = Pattern.compile(_query);
} catch (java.util.regex.PatternSyntaxException e) {
//e.printStackTrace();
}
if ("regex".equals(_mode)) {
try {
_pattern = Pattern.compile(
_query,
_caseSensitive ? 0 : Pattern.CASE_INSENSITIVE);
} catch (java.util.regex.PatternSyntaxException e) {
e.printStackTrace();
}
} else if (!_caseSensitive) {
_query = _query.toLowerCase();
}
}
}