"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] + "/");
}
var results = data.result;
var results = "result" in data ? data.result : [];
var entries1 = [];
var entries2 = [];

View File

@ -208,26 +208,41 @@ DataTableCellUI.prototype._searchForMatch = function() {
var match = null;
var commit = function() {
if (match != null) {
var params = {
judgment: "matched",
topicID: match.id,
topicGUID: match.guid,
topicName: match.name,
types: $.map(match.type, function(elmt) { return elmt.id; }).join(",")
var query = {
"id" : match.id,
"type" : []
};
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);
var baseUrl = "http://api.freebase.com/api/service/mqlread";
var url = baseUrl + "?" + $.param({ query: JSON.stringify({ query: query }) }) + "&callback=?";
$.getJSON(
url,
null,
function(o) {
var types = "result" in o ? o.result.type : [];
var params = {
judgment: "matched",
topicID: match.id,
topicGUID: match.guid,
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"
);
}
};