Make the number of reconciliation results configurable - closes #466
This commit is contained in:
parent
82b764d06c
commit
889245fdf4
@ -110,6 +110,8 @@ public class StandardReconConfig extends ReconConfig {
|
|||||||
|
|
||||||
JSONObject t = obj.has("type") && !obj.isNull("type") ? obj.getJSONObject("type") : null;
|
JSONObject t = obj.has("type") && !obj.isNull("type") ? obj.getJSONObject("type") : null;
|
||||||
|
|
||||||
|
int limit = obj.has("limit") ? obj.getInt("limit") : 0;
|
||||||
|
|
||||||
return new StandardReconConfig(
|
return new StandardReconConfig(
|
||||||
obj.getString("service"),
|
obj.getString("service"),
|
||||||
obj.has("identifierSpace") ? obj.getString("identifierSpace") : null,
|
obj.has("identifierSpace") ? obj.getString("identifierSpace") : null,
|
||||||
@ -117,7 +119,8 @@ public class StandardReconConfig extends ReconConfig {
|
|||||||
t == null ? null : t.getString("id"),
|
t == null ? null : t.getString("id"),
|
||||||
t == null ? null : (t.has("name") ? t.getString("name") : null),
|
t == null ? null : (t.has("name") ? t.getString("name") : null),
|
||||||
obj.getBoolean("autoMatch"),
|
obj.getBoolean("autoMatch"),
|
||||||
columnDetails
|
columnDetails,
|
||||||
|
limit
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,16 +142,41 @@ public class StandardReconConfig extends ReconConfig {
|
|||||||
final public String typeName;
|
final public String typeName;
|
||||||
final public boolean autoMatch;
|
final public boolean autoMatch;
|
||||||
final public List<ColumnDetail> columnDetails;
|
final public List<ColumnDetail> columnDetails;
|
||||||
|
final private int limit;
|
||||||
|
|
||||||
|
public StandardReconConfig(
|
||||||
|
String service,
|
||||||
|
String identifierSpace,
|
||||||
|
String schemaSpace,
|
||||||
|
|
||||||
|
String typeID,
|
||||||
|
String typeName,
|
||||||
|
boolean autoMatch,
|
||||||
|
List<ColumnDetail> columnDetails
|
||||||
|
) {
|
||||||
|
this(service, identifierSpace, schemaSpace, typeID, typeName, autoMatch, columnDetails, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param service
|
||||||
|
* @param identifierSpace
|
||||||
|
* @param schemaSpace
|
||||||
|
* @param typeID
|
||||||
|
* @param typeName
|
||||||
|
* @param autoMatch
|
||||||
|
* @param columnDetails
|
||||||
|
* @param limit maximum number of results to return (0 = default)
|
||||||
|
*/
|
||||||
public StandardReconConfig(
|
public StandardReconConfig(
|
||||||
String service,
|
String service,
|
||||||
String identifierSpace,
|
String identifierSpace,
|
||||||
String schemaSpace,
|
String schemaSpace,
|
||||||
|
|
||||||
String typeID,
|
String typeID,
|
||||||
String typeName,
|
String typeName,
|
||||||
boolean autoMatch,
|
boolean autoMatch,
|
||||||
List<ColumnDetail> columnDetails
|
List<ColumnDetail> columnDetails,
|
||||||
|
int limit
|
||||||
) {
|
) {
|
||||||
this.service = service;
|
this.service = service;
|
||||||
this.identifierSpace = identifierSpace;
|
this.identifierSpace = identifierSpace;
|
||||||
@ -158,6 +186,7 @@ public class StandardReconConfig extends ReconConfig {
|
|||||||
this.typeName = typeName;
|
this.typeName = typeName;
|
||||||
this.autoMatch = autoMatch;
|
this.autoMatch = autoMatch;
|
||||||
this.columnDetails = columnDetails;
|
this.columnDetails = columnDetails;
|
||||||
|
this.limit = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -189,6 +218,7 @@ public class StandardReconConfig extends ReconConfig {
|
|||||||
writer.endObject();
|
writer.endObject();
|
||||||
}
|
}
|
||||||
writer.endArray();
|
writer.endArray();
|
||||||
|
writer.key("limit"); writer.value(limit);
|
||||||
writer.endObject();
|
writer.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,6 +295,13 @@ public class StandardReconConfig extends ReconConfig {
|
|||||||
|
|
||||||
jsonWriter.endArray();
|
jsonWriter.endArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only send limit if it's non-default to preserve backward compatibility with
|
||||||
|
// services which might choke on this
|
||||||
|
if (limit != 0) {
|
||||||
|
jsonWriter.key("limit"); jsonWriter.value(limit);
|
||||||
|
}
|
||||||
|
|
||||||
jsonWriter.endObject();
|
jsonWriter.endObject();
|
||||||
|
|
||||||
job.text = cell.value.toString();
|
job.text = cell.value.toString();
|
||||||
@ -382,7 +419,7 @@ public class StandardReconConfig extends ReconConfig {
|
|||||||
try {
|
try {
|
||||||
int length = results.length();
|
int length = results.length();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = 0; i < length && count < 3; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
JSONObject result = results.getJSONObject(i);
|
JSONObject result = results.getJSONObject(i);
|
||||||
if (!result.has("name")) {
|
if (!result.has("name")) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -362,7 +362,8 @@
|
|||||||
"fb-guid": "a Freebase GUID, e.g., #9202a8c04000641f80000000000354ae",
|
"fb-guid": "a Freebase GUID, e.g., #9202a8c04000641f80000000000354ae",
|
||||||
"fb-key": "a Freebase key in",
|
"fb-key": "a Freebase key in",
|
||||||
"fb-en-ns": "the Wikipedia English namespace",
|
"fb-en-ns": "the Wikipedia English namespace",
|
||||||
"this-ns": "this namespace:"
|
"this-ns": "this namespace:",
|
||||||
|
"max-candidates" : "Maximum number of candidates to return"
|
||||||
},
|
},
|
||||||
"core-util-enc": {
|
"core-util-enc": {
|
||||||
"select-enc": "Select Encoding",
|
"select-enc": "Select Encoding",
|
||||||
|
@ -362,7 +362,9 @@
|
|||||||
"fb-guid": "a Freebase GUID, e.g., #9202a8c04000641f80000000000354ae",
|
"fb-guid": "a Freebase GUID, e.g., #9202a8c04000641f80000000000354ae",
|
||||||
"fb-key": "a Freebase key in",
|
"fb-key": "a Freebase key in",
|
||||||
"fb-en-ns": "the Wikipedia English namespace",
|
"fb-en-ns": "the Wikipedia English namespace",
|
||||||
"this-ns": "this namespace:"
|
"this-ns": "this namespace:",
|
||||||
|
"max-candidates" : "Maximum number of candidates to return"
|
||||||
|
|
||||||
},
|
},
|
||||||
"core-util-enc": {
|
"core-util-enc": {
|
||||||
"select-enc": "Select Encoding",
|
"select-enc": "Select Encoding",
|
||||||
|
@ -362,7 +362,9 @@
|
|||||||
"fb-guid": "un Freebase GUID, es: #9202a8c04000641f80000000000354ae",
|
"fb-guid": "un Freebase GUID, es: #9202a8c04000641f80000000000354ae",
|
||||||
"fb-key": "Una chiave Freebase nel",
|
"fb-key": "Una chiave Freebase nel",
|
||||||
"fb-en-ns": "namespace di Wikipedia inglese",
|
"fb-en-ns": "namespace di Wikipedia inglese",
|
||||||
"this-ns": "questo namespace:"
|
"this-ns": "questo namespace:",
|
||||||
|
// TODO: Translation required
|
||||||
|
// "max-candidates" : "Maximum number of candidates to return"
|
||||||
},
|
},
|
||||||
"core-util-enc": {
|
"core-util-enc": {
|
||||||
"select-enc": "Seleziona la codifica",
|
"select-enc": "Seleziona la codifica",
|
||||||
|
@ -29,5 +29,9 @@
|
|||||||
<td><input type="checkbox" checked bind="automatchCheck" /> <span bind="or_proc_autoMatch"></span></td>
|
<td><input type="checkbox" checked bind="automatchCheck" /> <span bind="or_proc_autoMatch"></span></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><span bind="or_proc_max_candidates"></span> <input type="number" bind="maxCandidates" min=0 max=9 width=20/> </td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
</table></div>
|
</table></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -90,6 +90,7 @@ ReconStandardServicePanel.prototype._constructUI = function() {
|
|||||||
this._elmts.or_proc_againsType.html($.i18n._('core-recon')["against-type"]+":");
|
this._elmts.or_proc_againsType.html($.i18n._('core-recon')["against-type"]+":");
|
||||||
this._elmts.or_proc_noType.html($.i18n._('core-recon')["no-type"]);
|
this._elmts.or_proc_noType.html($.i18n._('core-recon')["no-type"]);
|
||||||
this._elmts.or_proc_autoMatch.html($.i18n._('core-recon')["auto-match"]);
|
this._elmts.or_proc_autoMatch.html($.i18n._('core-recon')["auto-match"]);
|
||||||
|
this._elmts.or_proc_max_candidates.html($.i18n._('core-recon')["max-candidates"]);
|
||||||
|
|
||||||
this._elmts.rawServiceLink.attr("href", this._service.url);
|
this._elmts.rawServiceLink.attr("href", this._service.url);
|
||||||
|
|
||||||
@ -328,8 +329,9 @@ ReconStandardServicePanel.prototype.start = function() {
|
|||||||
identifierSpace: this._service.identifierSpace,
|
identifierSpace: this._service.identifierSpace,
|
||||||
schemaSpace: this._service.schemaSpace,
|
schemaSpace: this._service.schemaSpace,
|
||||||
type: (type) ? { id: type.id, name: type.name } : null,
|
type: (type) ? { id: type.id, name: type.name } : null,
|
||||||
autoMatch: this._elmts.automatchCheck[0].checked,
|
autoMatch: this._elmts.automatchCheck[0].checked,
|
||||||
columnDetails: columnDetails
|
columnDetails: columnDetails,
|
||||||
|
limit: this._elmts.maxCandidates[0].value
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
{ cellsChanged: true, columnStatsChanged: true }
|
{ cellsChanged: true, columnStatsChanged: true }
|
||||||
|
Loading…
Reference in New Issue
Block a user