"type" in freebase suggest results got dropped so we need to fetch the result's types ourselves.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@409 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-04-07 18:23:07 +00:00
parent c921fb703f
commit 302c27687c
2 changed files with 35 additions and 20 deletions

View File

@ -9,7 +9,7 @@
schemaPrefixes.push(includedTypes[i] + "/"); schemaPrefixes.push(includedTypes[i] + "/");
} }
var results = data.result; var results = "result" in data ? data.result : [];
var entries1 = []; var entries1 = [];
var entries2 = []; var entries2 = [];

View File

@ -208,26 +208,41 @@ DataTableCellUI.prototype._searchForMatch = function() {
var match = null; var match = null;
var commit = function() { var commit = function() {
if (match != null) { if (match != null) {
var params = { var query = {
judgment: "matched", "id" : match.id,
topicID: match.id, "type" : []
topicGUID: match.guid,
topicName: match.name,
types: $.map(match.type, function(elmt) { return elmt.id; }).join(",")
}; };
if (elmts.checkSimilar[0].checked) { var baseUrl = "http://api.freebase.com/api/service/mqlread";
params.similarValue = self._cell.v; var url = baseUrl + "?" + $.param({ query: JSON.stringify({ query: query }) }) + "&callback=?";
params.columnName = Gridworks.cellIndexToColumn(self._cellIndex).name;
$.getJSON(
self._postProcessSeveralCells("recon-judge-similar-cells", params, true); url,
} else { null,
params.row = self._rowIndex; function(o) {
params.cell = self._cellIndex; var types = "result" in o ? o.result.type : [];
var params = {
self._postProcessOneCell("recon-judge-one-cell", params, true); judgment: "matched",
} topicID: match.id,
topicGUID: match.guid,
DialogSystem.dismissUntil(level - 1); topicName: match.name,
types: $.map(types, function(elmt) { return elmt.id; }).join(",")
};
if (elmts.checkSimilar[0].checked) {
params.similarValue = self._cell.v;
params.columnName = Gridworks.cellIndexToColumn(self._cellIndex).name;
self._postProcessSeveralCells("recon-judge-similar-cells", params, true);
} else {
params.row = self._rowIndex;
params.cell = self._cellIndex;
self._postProcessOneCell("recon-judge-one-cell", params, true);
}
DialogSystem.dismissUntil(level - 1);
},
"jsonp"
);
} }
}; };