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: Fixes:
- Issue 34: "Behavior of Text Filter is unpredictable when "regular expression" mode is enabled." - Issue 34: "Behavior of Text Filter is unpredictable when "regular expression" mode is enabled."
Regex was not compiled with case insensitivity flag. 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) 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) { public boolean visit(Project project, int rowIndex, Row row, boolean includeContextual, boolean includeDependent) {
Cell cell = row.getCell(_cellIndex); Cell cell = row.getCell(_cellIndex);
if (cell != null && if (cell != null && ExpressionUtils.isNonBlankData(cell.value)) {
ExpressionUtils.isNonBlankData(cell.value) && String value = cell.value instanceof String ?
_similarValue.equals(cell.value)) { ((String) cell.value) : cell.value.toString();
Recon recon = null; if (_similarValue.equals(value)) {
if (_judgment == Judgment.New && _shareNewTopics) { Recon recon = null;
if (_sharedNewRecon == null) { if (_judgment == Judgment.New && _shareNewTopics) {
_sharedNewRecon = new Recon(_historyEntryID); if (_sharedNewRecon == null) {
_sharedNewRecon.judgment = Judgment.New; _sharedNewRecon = new Recon(_historyEntryID);
_sharedNewRecon.judgmentBatchSize = 0; _sharedNewRecon.judgment = Judgment.New;
_sharedNewRecon.judgmentAction = "similar"; _sharedNewRecon.judgmentBatchSize = 0;
} _sharedNewRecon.judgmentAction = "similar";
_sharedNewRecon.judgmentBatchSize++; }
_sharedNewRecon.judgmentBatchSize++;
recon = _sharedNewRecon;
} else { recon = _sharedNewRecon;
if (_dupReconMap.containsKey(cell.recon.id)) { } else {
recon = _dupReconMap.get(cell.recon.id); if (_dupReconMap.containsKey(cell.recon.id)) {
recon.judgmentBatchSize++; recon = _dupReconMap.get(cell.recon.id);
} else { recon.judgmentBatchSize++;
recon = cell.recon.dup(_historyEntryID); } else {
recon.judgmentBatchSize = 1; recon = cell.recon.dup(_historyEntryID);
recon.matchRank = -1; recon.judgmentBatchSize = 1;
recon.judgmentAction = "similar"; recon.matchRank = -1;
recon.judgmentAction = "similar";
if (_judgment == Judgment.Matched) {
recon.judgment = Recon.Judgment.Matched; if (_judgment == Judgment.Matched) {
recon.match = _match; recon.judgment = Recon.Judgment.Matched;
recon.match = _match;
if (recon.candidates != null) {
for (int m = 0; m < recon.candidates.size(); m++) { if (recon.candidates != null) {
if (recon.candidates.get(m).topicGUID.equals(_match.topicGUID)) { for (int m = 0; m < recon.candidates.size(); m++) {
recon.matchRank = m; if (recon.candidates.get(m).topicGUID.equals(_match.topicGUID)) {
break; recon.matchRank = m;
} break;
} }
} }
} else if (_judgment == Judgment.New) { }
recon.judgment = Recon.Judgment.New; } else if (_judgment == Judgment.New) {
recon.match = null; recon.judgment = Recon.Judgment.New;
} else if (_judgment == Judgment.None) { recon.match = null;
recon.judgment = Recon.Judgment.None; } else if (_judgment == Judgment.None) {
recon.match = null; recon.judgment = Recon.Judgment.None;
} recon.match = null;
}
_dupReconMap.put(cell.recon.id, recon);
} _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; return false;
} }