"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,12 +208,24 @@ DataTableCellUI.prototype._searchForMatch = function() {
var match = null; var match = null;
var commit = function() { var commit = function() {
if (match != null) { if (match != null) {
var query = {
"id" : match.id,
"type" : []
};
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 = { var params = {
judgment: "matched", judgment: "matched",
topicID: match.id, topicID: match.id,
topicGUID: match.guid, topicGUID: match.guid,
topicName: match.name, topicName: match.name,
types: $.map(match.type, function(elmt) { return elmt.id; }).join(",") types: $.map(types, function(elmt) { return elmt.id; }).join(",")
}; };
if (elmts.checkSimilar[0].checked) { if (elmts.checkSimilar[0].checked) {
params.similarValue = self._cell.v; params.similarValue = self._cell.v;
@ -228,6 +240,9 @@ DataTableCellUI.prototype._searchForMatch = function() {
} }
DialogSystem.dismissUntil(level - 1); DialogSystem.dismissUntil(level - 1);
},
"jsonp"
);
} }
}; };