Fixed issue 4: Match All bug with ZIP code.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@767 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-05-14 17:03:33 +00:00
parent bd87e079b2
commit 6450921c02
2 changed files with 56 additions and 53 deletions

View File

@ -3,7 +3,8 @@ Ongoing
Fixes:
- Issue 34: "Behavior of Text Filter is unpredictable when "regular expression" mode is enabled."
Regex was not compiled with case insensitivity flag.
- Issue 4: "Match All bug with ZIP code". Numeric values in cells were not stringified first
before comparison.
1.0.1 Release (May 12, 2010)

View File

@ -164,59 +164,61 @@ public class ReconJudgeSimilarCellsOperation extends EngineDependentMassCellOper
public boolean visit(Project project, int rowIndex, Row row, boolean includeContextual, boolean includeDependent) {
Cell cell = row.getCell(_cellIndex);
if (cell != null &&
ExpressionUtils.isNonBlankData(cell.value) &&
_similarValue.equals(cell.value)) {
Recon recon = null;
if (_judgment == Judgment.New && _shareNewTopics) {
if (_sharedNewRecon == null) {
_sharedNewRecon = new Recon(_historyEntryID);
_sharedNewRecon.judgment = Judgment.New;
_sharedNewRecon.judgmentBatchSize = 0;
_sharedNewRecon.judgmentAction = "similar";
}
_sharedNewRecon.judgmentBatchSize++;
recon = _sharedNewRecon;
} else {
if (_dupReconMap.containsKey(cell.recon.id)) {
recon = _dupReconMap.get(cell.recon.id);
recon.judgmentBatchSize++;
} else {
recon = cell.recon.dup(_historyEntryID);
recon.judgmentBatchSize = 1;
recon.matchRank = -1;
recon.judgmentAction = "similar";
if (_judgment == Judgment.Matched) {
recon.judgment = Recon.Judgment.Matched;
recon.match = _match;
if (recon.candidates != null) {
for (int m = 0; m < recon.candidates.size(); m++) {
if (recon.candidates.get(m).topicGUID.equals(_match.topicGUID)) {
recon.matchRank = m;
break;
}
}
}
} else if (_judgment == Judgment.New) {
recon.judgment = Recon.Judgment.New;
recon.match = null;
} else if (_judgment == Judgment.None) {
recon.judgment = Recon.Judgment.None;
recon.match = null;
}
_dupReconMap.put(cell.recon.id, recon);
}
if (cell != null && ExpressionUtils.isNonBlankData(cell.value)) {
String value = cell.value instanceof String ?
((String) cell.value) : cell.value.toString();
if (_similarValue.equals(value)) {
Recon recon = null;
if (_judgment == Judgment.New && _shareNewTopics) {
if (_sharedNewRecon == null) {
_sharedNewRecon = new Recon(_historyEntryID);
_sharedNewRecon.judgment = Judgment.New;
_sharedNewRecon.judgmentBatchSize = 0;
_sharedNewRecon.judgmentAction = "similar";
}
_sharedNewRecon.judgmentBatchSize++;
recon = _sharedNewRecon;
} else {
if (_dupReconMap.containsKey(cell.recon.id)) {
recon = _dupReconMap.get(cell.recon.id);
recon.judgmentBatchSize++;
} else {
recon = cell.recon.dup(_historyEntryID);
recon.judgmentBatchSize = 1;
recon.matchRank = -1;
recon.judgmentAction = "similar";
if (_judgment == Judgment.Matched) {
recon.judgment = Recon.Judgment.Matched;
recon.match = _match;
if (recon.candidates != null) {
for (int m = 0; m < recon.candidates.size(); m++) {
if (recon.candidates.get(m).topicGUID.equals(_match.topicGUID)) {
recon.matchRank = m;
break;
}
}
}
} else if (_judgment == Judgment.New) {
recon.judgment = Recon.Judgment.New;
recon.match = null;
} else if (_judgment == Judgment.None) {
recon.judgment = Recon.Judgment.None;
recon.match = null;
}
_dupReconMap.put(cell.recon.id, recon);
}
}
Cell newCell = new Cell(cell.value, recon);
CellChange cellChange = new CellChange(rowIndex, _cellIndex, cell, newCell);
_cellChanges.add(cellChange);
}
Cell newCell = new Cell(cell.value, recon);
CellChange cellChange = new CellChange(rowIndex, _cellIndex, cell, newCell);
_cellChanges.add(cellChange);
}
return false;
}