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)) {
|
if (ExpressionUtils.isError(value)) {
|
||||||
errorCount++;
|
errorCount++;
|
||||||
} else if (ExpressionUtils.isNonBlankData(value)) {
|
} 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)) {
|
if (choices.containsKey(valueString)) {
|
||||||
choices.get(value).count++;
|
choices.get(valueString).count++;
|
||||||
} else {
|
} else {
|
||||||
NominalFacetChoice choice = new NominalFacetChoice(dValue);
|
NominalFacetChoice choice = new NominalFacetChoice(dValue);
|
||||||
choice.count = 1;
|
choice.count = 1;
|
||||||
|
|
||||||
choices.put(value, choice);
|
choices.put(valueString, choice);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
blankCount++;
|
blankCount++;
|
||||||
|
@ -116,8 +116,9 @@ public class ListFacet implements Facet {
|
|||||||
_choices.addAll(grouper.choices.values());
|
_choices.addAll(grouper.choices.values());
|
||||||
|
|
||||||
for (NominalFacetChoice choice : _selection) {
|
for (NominalFacetChoice choice : _selection) {
|
||||||
if (grouper.choices.containsKey(choice.decoratedValue.value)) {
|
String valueString = choice.decoratedValue.value.toString();
|
||||||
grouper.choices.get(choice.decoratedValue.value).selected = true;
|
if (grouper.choices.containsKey(valueString)) {
|
||||||
|
grouper.choices.get(valueString).selected = true;
|
||||||
} else {
|
} else {
|
||||||
choice.count = 0;
|
choice.count = 0;
|
||||||
_choices.add(choice);
|
_choices.add(choice);
|
||||||
|
@ -47,7 +47,7 @@ public class ExpressionEqualRowFilter implements RowFilter {
|
|||||||
return _selectError;
|
return _selectError;
|
||||||
} else if (ExpressionUtils.isNonBlankData(v)) {
|
} else if (ExpressionUtils.isNonBlankData(v)) {
|
||||||
for (Object match : _matches) {
|
for (Object match : _matches) {
|
||||||
if (match.equals(v)) {
|
if (testValue(v, match)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,4 +56,10 @@ public class ExpressionEqualRowFilter implements RowFilter {
|
|||||||
return _selectBlank;
|
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