Fixed bug in list facet: list facets on columns with numeric data weren't working before.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@169 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
b488d093c8
commit
59c5314e42
@ -47,15 +47,18 @@ public class ExpressionNominalRowGrouper implements RowVisitor {
|
||||
if (ExpressionUtils.isError(value)) {
|
||||
errorCount++;
|
||||
} else if (ExpressionUtils.isNonBlankData(value)) {
|
||||
DecoratedValue dValue = new DecoratedValue(value, value.toString());
|
||||
String valueString = value.toString();
|
||||
String label = value.toString();
|
||||
|
||||
DecoratedValue dValue = new DecoratedValue(value, label);
|
||||
|
||||
if (choices.containsKey(value)) {
|
||||
choices.get(value).count++;
|
||||
if (choices.containsKey(valueString)) {
|
||||
choices.get(valueString).count++;
|
||||
} else {
|
||||
NominalFacetChoice choice = new NominalFacetChoice(dValue);
|
||||
choice.count = 1;
|
||||
|
||||
choices.put(value, choice);
|
||||
choices.put(valueString, choice);
|
||||
}
|
||||
} else {
|
||||
blankCount++;
|
||||
|
@ -116,8 +116,9 @@ public class ListFacet implements Facet {
|
||||
_choices.addAll(grouper.choices.values());
|
||||
|
||||
for (NominalFacetChoice choice : _selection) {
|
||||
if (grouper.choices.containsKey(choice.decoratedValue.value)) {
|
||||
grouper.choices.get(choice.decoratedValue.value).selected = true;
|
||||
String valueString = choice.decoratedValue.value.toString();
|
||||
if (grouper.choices.containsKey(valueString)) {
|
||||
grouper.choices.get(valueString).selected = true;
|
||||
} else {
|
||||
choice.count = 0;
|
||||
_choices.add(choice);
|
||||
|
@ -47,7 +47,7 @@ public class ExpressionEqualRowFilter implements RowFilter {
|
||||
return _selectError;
|
||||
} else if (ExpressionUtils.isNonBlankData(v)) {
|
||||
for (Object match : _matches) {
|
||||
if (match.equals(v)) {
|
||||
if (testValue(v, match)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -56,4 +56,10 @@ public class ExpressionEqualRowFilter implements RowFilter {
|
||||
return _selectBlank;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean testValue(Object v, Object match) {
|
||||
return (v instanceof Number && match instanceof Number) ?
|
||||
((Number) match).doubleValue() == ((Number) v).doubleValue() :
|
||||
match.equals(v);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user